Issue Details (XML | Word | Printable)

Key: JDO-229
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Michael Watzek
Reporter: Michael Watzek
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JDO

Class DeleteCallback must not assume managed relationships.

Created: 06/Dec/05 11:03 PM   Updated: 08/Dec/05 07:10 PM
Return to search
Component/s: tck2
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works JDO-229.patch 2005-12-06 11:07 PM Michael Watzek 13 kB
File Licensed for inclusion in ASF works JDO-229.patch2 2005-12-08 01:21 AM Michael Watzek 15 kB

Resolution Date: 08/Dec/05 07:10 PM


 Description  « Hide
There is a portability issue with test case DeleteCallback:

The test case assumes that a JDO implementation supports managed relationships, because it deletes instances which are referenced by other instances. Given that the relationships are represented by foreign keys in the database for which the delete rule is specified as RESTRICT, the test will cause errors for JDO implementations which do not support managed relationships, because it does not nullify those references explicitely,

In order to make the test case portable, it should explicitely nullify references to all deleted objects first. Afterwards, it should call Query.deletePersistentAll.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Michael Watzek added a comment - 06/Dec/05 11:07 PM
The attached patch implements the comments above.

Craig Russell added a comment - 07/Dec/05 03:23 AM
Just a few comments.

1. The line:
                lifecycleVerifyer = new LifecycleVerifier(result);
should probably also change the name of the variable, to:
                lifecycleVerifier = new LifecycleVerifier(result);

2. The code to clear relationships for the deletePersistentAll problem doesn't appear to solve the issue. The issue is not relationships FROM the employees, it's relationships TO the employee that are represented by database constraints.

+ * If instances are employees, then all relationships are cleared.
* If instances are employees, relationships to the employee are cleared.

+ employee.setDentalInsurance(null);
employee.getDentalInsurance.setEmployee(null);
+ employee.setMedicalInsurance(null);
employee.getMedicalInsurance.setEmployee(null);
+ employee.setDepartment(null);
don't need anything
+ employee.setFundingDept(null);
don't need anything
+ employee.setManager(null);
don't need anything
+ employee.setMentor(null);
employee.getMentor().setProtege(null);
+ employee.setHradvisor(null);
don't need anything
+ employee.setReviewedProjects(new HashSet());
foreach Project p in employee.getReviewedProjects(){p.removeReviewer(employee);}
+ employee.setProjects(new HashSet());
foreach Project p in employee.getProjects() {p.removeMember(employee);}


Michael Watzek added a comment - 08/Dec/05 01:21 AM
The second patch implements the comments above.

Michael Bouschen added a comment - 08/Dec/05 06:54 PM
The second patch looks good.

Michael Watzek added a comment - 08/Dec/05 07:10 PM
The second patch has been checked in (revision 355060).