
|
If you were logged in you would be able to see more operations.
|
|
|
| Resolution Date: |
14/Sep/06 09:34 PM
|
|
Multiple test cases attempt to bulk delete instances of Person. However, the Employee subclass of Person might wind up having a non-nullable foreign key reference to Insurance or another Employee (via the "mentor" field). While the defaut Derby TCK schema does not have this constraint, in order to be flexible for other databases that will enforce the foreign key by default, some effort should be made to ensure that there are no relation constraints before the bulk deletes are attempted. This can be done by adding a nullForeignKeyReferences() method that will manually make sure that the relations are nulled. See the attached patch.
This affects the following tests:
org.apache.jdo.tck.query.delete.DeletePersistentAll.testNoParametersAPI
org.apache.jdo.tck.query.delete.DeletePersistentAll.testNoParametersSingleString
org.apache.jdo.tck.query.delete.DeletePersistentAll.testObjectArrayParametersAPI
org.apache.jdo.tck.query.delete.DeletePersistentAll.testObjectArrayParametersSingleString
org.apache.jdo.tck.query.delete.DeletePersistentAll.testMapParametersAPI
org.apache.jdo.tck.query.delete.DeletePersistentAll.testMapParametersSingleString
org.apache.jdo.tck.query.delete.DeleteQueryElements.testAPI
org.apache.jdo.tck.query.delete.DeleteQueryElements.testSingleString
|
|
Description
|
Multiple test cases attempt to bulk delete instances of Person. However, the Employee subclass of Person might wind up having a non-nullable foreign key reference to Insurance or another Employee (via the "mentor" field). While the defaut Derby TCK schema does not have this constraint, in order to be flexible for other databases that will enforce the foreign key by default, some effort should be made to ensure that there are no relation constraints before the bulk deletes are attempted. This can be done by adding a nullForeignKeyReferences() method that will manually make sure that the relations are nulled. See the attached patch.
This affects the following tests:
org.apache.jdo.tck.query.delete.DeletePersistentAll.testNoParametersAPI
org.apache.jdo.tck.query.delete.DeletePersistentAll.testNoParametersSingleString
org.apache.jdo.tck.query.delete.DeletePersistentAll.testObjectArrayParametersAPI
org.apache.jdo.tck.query.delete.DeletePersistentAll.testObjectArrayParametersSingleString
org.apache.jdo.tck.query.delete.DeletePersistentAll.testMapParametersAPI
org.apache.jdo.tck.query.delete.DeletePersistentAll.testMapParametersSingleString
org.apache.jdo.tck.query.delete.DeleteQueryElements.testAPI
org.apache.jdo.tck.query.delete.DeleteQueryElements.testSingleString
|
Show » |
|
The whole point in adding the delete API to the Query interface is to support instance removal without the need to load these instances before the removal. I think using class Person to test the delete API is not a good idea. As Marc pointed out, it requires nulling relationship fields prior to the removal and this means loading instances into memory. So it might happen that the instances to be deleted are loaded prior to removal which is not the intent of the test case.
I propose to change the test case and use a class where the database schema does not include any foreign keys referencing the table for the class. In the company model class Insurance is an example for such a class. The attached patch for review implements this proposal.