castor

Objects loaded in different transactions can't be referenced in another long transaction.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 0.9.7
  • Fix Version/s: 1.3 rc1
  • Component/s: JDO
  • Labels:
    None
  • Environment:
  • Testcase included:
    yes
  • Number of attachments :
    11

Description

Hi,

I'm getting trouble with objects loaded in diferent long transactions, in short:

//1st transaction
db.begin();
StateCountry state = db.load(StateCountry.class, "AASTCTPR");
db.commit();
..

//2nd transaction
db.begin();
Country country = db.load(Country.class, "AAAACTBR");
db.commit();
...

//3rd transaction
state.setMyCountry(state);
..
db.begin();
db.update(state);
db.commit();
..

this trouble are same as reported in email:
http://www.mail-archive.com/castor-user@exolab.org/msg00953.html

I attached a test case, that output:

[ClientAPP] populateData executed!
[ClientAPP] 1st operation executed!
[ClientAPP] StateCountry retrieved: ctf.jdo.tc0cw.StateCountry@19ce060 { oid: 'AASTBRPR', name: 'PARANA', myCountry: 'AAAACTBR', timestamp: 1123762499887 }
[ClientAPP] Country retrieved: ctf.jdo.tc0cw.Country@1359c1b { oid: 'AAAACTTS', name: 'COUNTRY FOR TEST', timestamp: 1123762499912 }
[ClientAPP] 2nd operation executed!
[ServerApp] fails with message: Nested error: org.exolab.castor.jdo.PersistenceException: Object, ctf.jdo.tc0cw.StateCountry@19ce060 { oid: 'AASTBRPR', name: 'PARANA', myCountry: 'AAAACTTS', timestamp: 1123762499887 }, links to another object, ctf.jdo.tc0cw.Country@1359c1b { oid: 'AAAACTTS', name: 'COUNTRY FOR TEST', timestamp: 1123762499912 } that is not loaded/updated/created in this transaction: Object, ctf.jdo.tc0cw.StateCountry@19ce060 { oid: 'AASTBRPR', name: 'PARANA', myCountry: 'AAAACTTS', timestamp: 1123762499887 }, links to another object, ctf.jdo.tc0cw.Country@1359c1b { oid: 'AAAACTTS', name: 'COUNTRY FOR TEST', timestamp: 1123762499912 } that is not loaded/updated/created in this transaction
[ClientAPP] testRetrieveMany 3rd operation failed on server with message: Nested error: org.exolab.castor.jdo.PersistenceException: Object, ctf.jdo.tc0cw.StateCountry@19ce060 { oid: 'AASTBRPR', name: 'PARANA', myCountry: 'AAAACTTS', timestamp: 1123762499887 }, links to another object, ctf.jdo.tc0cw.Country@1359c1b { oid: 'AAAACTTS', name: 'COUNTRY FOR TEST', timestamp: 1123762499912 } that is not loaded/updated/created in this transaction: Object, ctf.jdo.tc0cw.StateCountry@19ce060 { oid: 'AASTBRPR', name: 'PARANA', myCountry: 'AAAACTTS', timestamp: 1123762499887 }, links to another object, ctf.jdo.tc0cw.Country@1359c1b { oid: 'AAAACTTS', name: 'COUNTRY FOR TEST', timestamp: 1123762499912 } that is not loaded/updated/created in this transaction
[ClientAPP] Objects retrieved for delete: [ctf.jdo.tc0cw.StateCountry@164dbd5 { oid: 'AASTBRPR', name: 'PARANA', myCountry: 'AAAACTBR', timestamp: 1123762499887 }, ctf.jdo.tc0cw.StateCountry@125844f { oid: 'AASTBRSP', name: 'SAO PAULO', myCountry: 'AAAACTBR', timestamp: 1123762499897 }, ctf.jdo.tc0cw.Country@9cb0f4 { oid: 'AAAACTBR', name: 'BRAZIL', timestamp: 1123762499879 }, ctf.jdo.tc0cw.StateCountry@11978b { oid: 'AASTUSTX', name: 'TEXAS', myCountry: 'AAAACTUS', timestamp: 1123762499904 }, ctf.jdo.tc0cw.StateCountry@26dbec { oid: 'AASTUSCL', name: 'COLORADO', myCountry: 'AAAACTUS', timestamp: 1123762499909 }, ctf.jdo.tc0cw.Country@f42ad0 { oid: 'AAAACTUS', name: 'UNITED STATES', timestamp: 1123762499900 }, ctf.jdo.tc0cw.Country@1309e87 { oid: 'AAAACTTS', name: 'COUNTRY FOR TEST', timestamp: 1123762499912 }]
[ServerApp] fails with message: The object of type ctf.jdo.tc0cw.StateCountry is not persistent – it was not queried or created within this transaction
[ClientAPP] removeData delete operation failed on server with message: The object of type ctf.jdo.tc0cw.StateCountry is not persistent – it was not queried or created within this transaction

//end of output

Note that this trouble occurs for update and delete.

  1. patch-C1196-20050811.txt
    11/Aug/05 5:14 PM
    24 kB
    Clovis Wichoski
  2. patch-C1196-20050815.txt
    15/Aug/05 1:17 PM
    26 kB
    Clovis Wichoski
  3. patch-C1196-20050816.txt
    16/Aug/05 2:44 PM
    28 kB
    Clovis Wichoski
  4. patch-C1196-20050817.txt
    17/Aug/05 4:40 PM
    30 kB
    Clovis Wichoski
  5. patch-C1196-20050819.txt
    19/Aug/05 2:03 PM
    33 kB
    Clovis Wichoski
  6. patch-C1196-20050820.txt
    19/Aug/05 6:22 PM
    36 kB
    Ralf Joachim
  7. patch-C1196-20050826.txt
    26/Aug/05 8:57 AM
    55 kB
    Clovis Wichoski
  8. patch-C1196-20050901.txt
    01/Sep/05 4:54 PM
    55 kB
    Ralf Joachim
  9. patch-C1196-20050912.txt
    12/Sep/05 11:58 AM
    40 kB
    Clovis Wichoski
  10. patch-C1196-20050913.txt
    13/Sep/05 4:23 PM
    45 kB
    Ralf Joachim
  11. patch-C1196-20080923.txt
    23/Sep/08 3:24 PM
    37 kB
    Ralf Joachim

Issue Links

Activity

Hide
Gregory Block added a comment -

I wonder if this ends up being the same fundamental problem as CASTOR-1195 has...

Show
Gregory Block added a comment - I wonder if this ends up being the same fundamental problem as CASTOR-1195 has...
Hide
Clovis Wichoski added a comment -

yes, maybe, but here we have direct reference and no polymorphism, maybe attached patch that includes a test case, can be used to test the issue in CASTOR-1195 too.

please ignore the testCase.tar.gz file attached, I wrong attached this file, now I attached using the patch pattern, thanks to Ralf, that without his help the creation of patch dont be possible,

Show
Clovis Wichoski added a comment - yes, maybe, but here we have direct reference and no polymorphism, maybe attached patch that includes a test case, can be used to test the issue in CASTOR-1195 too. please ignore the testCase.tar.gz file attached, I wrong attached this file, now I attached using the patch pattern, thanks to Ralf, that without his help the creation of patch dont be possible,
Hide
Werner Guttmann added a comment -

I am not sure whetehr this is related to CASTOR-1195 or not, but I actually think that this might be related to CASTOR-818.

Show
Werner Guttmann added a comment - I am not sure whetehr this is related to CASTOR-1195 or not, but I actually think that this might be related to CASTOR-818.
Hide
Clovis Wichoski added a comment -

after reading CASTOR-818, I think that no, because, in this case, I dont have lazy loading, and the classes are too simple, follow are the map that is inside of the testCase:

<mapping>
<!-- Country -->
<class name="jdo.bug1196.Country" identity="oid" access="shared">
<description>Coutry</description>
<cache-type type="count-limited" capacity="20"/>
<map-to table="COUNTRY"/>
<field type="string" required="false" name="oid" lazy="false" direct="false">
<sql type="char" name="OID" dirty="ignore"/>
<xml node="element" name="oid"/>
</field>
<field type="string" required="false" name="name" lazy="false" direct="false">
<sql type="char" name="NAME" dirty="ignore"/>
</field>
</class>

<!-- CountryState -->
<class name="jdo.bug1196.StateCountry" identity="oid" access="shared">
<description>State Country</description>
<cache-type type="count-limited" capacity="50"/>
<map-to table="STATECOUNTRY"/>
<field type="string" required="false" name="oid" lazy="false" direct="false">
<sql type="char" name="OID" dirty="ignore"/>
</field>
<field type="string" required="false" name="name" lazy="false" direct="false">
<sql type="char" name="NAME" dirty="ignore"/>
</field>
<!-- References -->
<field type="jdo.bug1196.Country" required="false" name="myCountry" lazy="false" direct="false">
<sql name="MY_COUNTRY" dirty="ignore"/>
</field>
</class>

</mapping>

since the classes are too simple, maybe the way that castor manage things, have changed, because this same code works with an older version 0.9.3.9.

Show
Clovis Wichoski added a comment - after reading CASTOR-818, I think that no, because, in this case, I dont have lazy loading, and the classes are too simple, follow are the map that is inside of the testCase: <mapping> <!-- Country --> <class name="jdo.bug1196.Country" identity="oid" access="shared"> <description>Coutry</description> <cache-type type="count-limited" capacity="20"/> <map-to table="COUNTRY"/> <field type="string" required="false" name="oid" lazy="false" direct="false"> <sql type="char" name="OID" dirty="ignore"/> <xml node="element" name="oid"/> </field> <field type="string" required="false" name="name" lazy="false" direct="false"> <sql type="char" name="NAME" dirty="ignore"/> </field> </class> <!-- CountryState --> <class name="jdo.bug1196.StateCountry" identity="oid" access="shared"> <description>State Country</description> <cache-type type="count-limited" capacity="50"/> <map-to table="STATECOUNTRY"/> <field type="string" required="false" name="oid" lazy="false" direct="false"> <sql type="char" name="OID" dirty="ignore"/> </field> <field type="string" required="false" name="name" lazy="false" direct="false"> <sql type="char" name="NAME" dirty="ignore"/> </field> <!-- References --> <field type="jdo.bug1196.Country" required="false" name="myCountry" lazy="false" direct="false"> <sql name="MY_COUNTRY" dirty="ignore"/> </field> </class> </mapping> since the classes are too simple, maybe the way that castor manage things, have changed, because this same code works with an older version 0.9.3.9.
Hide
Clovis Wichoski added a comment -

added patch-C1196-20050815.txt that fit best about a question in chat with Ralf that ask "you transfer object A to your client. A references object B1 so it is also transfered to the client. In additon you also transfer B2 to client. client changes A to refer to B2 instead of B1 and calls update. while this happens another client may have changed B2. this would cause a ObjectModifiedException if autostore is set to true." and yes, is exactly this that occurs here then always I need autoStore to false, then:

with this updated testCase setting autostore to true we get:

org.exolab.castor.jdo.ObjectModifiedException: Timestamp mismatched!
at org.exolab.castor.persist.ClassMolder.update(ClassMolder.java:1957)
at org.exolab.castor.persist.LockEngine.update(LockEngine.java:659)
at org.castor.persist.TransactionContext.markUpdate(TransactionContext.java:1138)
at org.exolab.castor.persist.ClassMolder.update(ClassMolder.java:2004)
at org.exolab.castor.persist.LockEngine.update(LockEngine.java:659)
at org.castor.persist.TransactionContext.markUpdate(TransactionContext.java:1138)
at org.castor.persist.TransactionContext.update(TransactionContext.java:1222)
at org.exolab.castor.jdo.engine.DatabaseImpl.update(DatabaseImpl.java:379)
at jdo.bug1196.ServerApp.update(ServerApp.java:100)
at jdo.bug1196.ServerApp.doOperationControl(ServerApp.java:32)
at jdo.bug1196.ClientApp.send(ClientApp.java:26)
at jdo.bug1196.ClientApp.changeStateCountry(ClientApp.java:161)
...

and, setting autostore to false we get:
org.exolab.castor.jdo.PersistenceException: Object, jdo.bug1196.StateCountry@3ae941 { oid: 'AASTBRPR', name: 'PARANA', myCountry: 'AAAACTTS', timestamp: 1124128924831 }, links to another object, jdo.bug1196.Country@1c6572b { oid: 'AAAACTTS', name: 'COUNTRY FOR TEST', timestamp: 1124128924867 } that is not loaded/updated/created in this transaction
at org.castor.persist.TransactionContext.prepare(TransactionContext.java:1601)
at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:518)
at jdo.bug1196.ServerApp.update(ServerApp.java:107)
at jdo.bug1196.ServerApp.doOperationControl(ServerApp.java:32)
at jdo.bug1196.ClientApp.send(ClientApp.java:26)
at jdo.bug1196.ClientApp.changeStateCountry(ClientApp.java:161)
...

I updated the testCase, because, the old only setting autoStore to true, the test pass, getting wrong results, because we work with many clients.

TIA

Clovis

Show
Clovis Wichoski added a comment - added patch-C1196-20050815.txt that fit best about a question in chat with Ralf that ask "you transfer object A to your client. A references object B1 so it is also transfered to the client. In additon you also transfer B2 to client. client changes A to refer to B2 instead of B1 and calls update. while this happens another client may have changed B2. this would cause a ObjectModifiedException if autostore is set to true." and yes, is exactly this that occurs here then always I need autoStore to false, then: with this updated testCase setting autostore to true we get: org.exolab.castor.jdo.ObjectModifiedException: Timestamp mismatched! at org.exolab.castor.persist.ClassMolder.update(ClassMolder.java:1957) at org.exolab.castor.persist.LockEngine.update(LockEngine.java:659) at org.castor.persist.TransactionContext.markUpdate(TransactionContext.java:1138) at org.exolab.castor.persist.ClassMolder.update(ClassMolder.java:2004) at org.exolab.castor.persist.LockEngine.update(LockEngine.java:659) at org.castor.persist.TransactionContext.markUpdate(TransactionContext.java:1138) at org.castor.persist.TransactionContext.update(TransactionContext.java:1222) at org.exolab.castor.jdo.engine.DatabaseImpl.update(DatabaseImpl.java:379) at jdo.bug1196.ServerApp.update(ServerApp.java:100) at jdo.bug1196.ServerApp.doOperationControl(ServerApp.java:32) at jdo.bug1196.ClientApp.send(ClientApp.java:26) at jdo.bug1196.ClientApp.changeStateCountry(ClientApp.java:161) ... and, setting autostore to false we get: org.exolab.castor.jdo.PersistenceException: Object, jdo.bug1196.StateCountry@3ae941 { oid: 'AASTBRPR', name: 'PARANA', myCountry: 'AAAACTTS', timestamp: 1124128924831 }, links to another object, jdo.bug1196.Country@1c6572b { oid: 'AAAACTTS', name: 'COUNTRY FOR TEST', timestamp: 1124128924867 } that is not loaded/updated/created in this transaction at org.castor.persist.TransactionContext.prepare(TransactionContext.java:1601) at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:518) at jdo.bug1196.ServerApp.update(ServerApp.java:107) at jdo.bug1196.ServerApp.doOperationControl(ServerApp.java:32) at jdo.bug1196.ClientApp.send(ClientApp.java:26) at jdo.bug1196.ClientApp.changeStateCountry(ClientApp.java:161) ... I updated the testCase, because, the old only setting autoStore to true, the test pass, getting wrong results, because we work with many clients. TIA Clovis
Hide
Clovis Wichoski added a comment -

file patch-C1196-20050816.txt add with includes changes in ClassMolder, please note in Environment that I'm using a patch applied from CASTOR-1179 too.

Show
Clovis Wichoski added a comment - file patch-C1196-20050816.txt add with includes changes in ClassMolder, please note in Environment that I'm using a patch applied from CASTOR-1179 too.
Hide
Ralf Joachim added a comment -

Hi Clovis, I'm sorry but the discussion with Werner took a little bit longer than expected as we also talked about 2 other issues. According to this one we both see that it is a common usecase that also references to other objects should be resolved also if autostore is set to false. In general your patch to ClassMolder seams to be OK for the unidirectional 1:m relations you are using. As we both are not sure if it breaks things in other usecases (bidirectional 1:m or bidirectional 1:1) we would apreciate the following additions:

1) Your current test case give us a good view how you are using castor but as you included parts of your framework it makes it hard to understand what really will be tested with the test case. Therefore it would be great if you could reduce your test to a minimum which are Country, StateCountry and TestLongTransaction classes. The TestLongTransaction class may have methods to create and remove test objects in database as well as one that executes the real test. I think the other classes are not required to reproduce the problem.

2) Add another test method that tests the same situation but with bidirectional 1:m relation.

3) Add another test method that tests the same situation but with bidirectional 1:1 relation.

I think you understand why we would like to see this additional tests and hope that you will help us with this task.

Show
Ralf Joachim added a comment - Hi Clovis, I'm sorry but the discussion with Werner took a little bit longer than expected as we also talked about 2 other issues. According to this one we both see that it is a common usecase that also references to other objects should be resolved also if autostore is set to false. In general your patch to ClassMolder seams to be OK for the unidirectional 1:m relations you are using. As we both are not sure if it breaks things in other usecases (bidirectional 1:m or bidirectional 1:1) we would apreciate the following additions: 1) Your current test case give us a good view how you are using castor but as you included parts of your framework it makes it hard to understand what really will be tested with the test case. Therefore it would be great if you could reduce your test to a minimum which are Country, StateCountry and TestLongTransaction classes. The TestLongTransaction class may have methods to create and remove test objects in database as well as one that executes the real test. I think the other classes are not required to reproduce the problem. 2) Add another test method that tests the same situation but with bidirectional 1:m relation. 3) Add another test method that tests the same situation but with bidirectional 1:1 relation. I think you understand why we would like to see this additional tests and hope that you will help us with this task.
Hide
Clovis Wichoski added a comment -

file patch-C1196-20050817.txt added with includes changes in ClassMolder, and note for bidirectional tests we have some TODO, maybe more bugs.

Show
Clovis Wichoski added a comment - file patch-C1196-20050817.txt added with includes changes in ClassMolder, and note for bidirectional tests we have some TODO, maybe more bugs.
Hide
Clovis Wichoski added a comment -

new patch patch-C1196-20050819.txt added with some TODO solved, now trying to solve problem with backReferences in bidirectional

Show
Clovis Wichoski added a comment - new patch patch-C1196-20050819.txt added with some TODO solved, now trying to solve problem with backReferences in bidirectional
Hide
Ralf Joachim added a comment -

New patch including the fix of CASTOR-1203.

Show
Ralf Joachim added a comment - New patch including the fix of CASTOR-1203.
Hide
Clovis Wichoski added a comment -

hi

I added a new patch, with changes in ClassMolder and PersistanceCapableRelationResolver, and created tests for
Unidirectional, Simple Bidirectional and Complex Bidirectioal, at this, I solved the problem with long transactions without autostore, but we need discuss more about things in this patch:

1) load ClassMolder based on value (maybe solves other issues for troubles with polymorphism), see patch to better understand.
2) who needs control bidirectional references, user or Castor, if Castor who deal with it, when user control the bidirectional references like in this patch?

note: in creation of this testCase if found more two issues one with dirty=ignore and other with rollback of timestamps, I will make a more simple testCase for both after. and create new ISSUES,

Show
Clovis Wichoski added a comment - hi I added a new patch, with changes in ClassMolder and PersistanceCapableRelationResolver, and created tests for Unidirectional, Simple Bidirectional and Complex Bidirectioal, at this, I solved the problem with long transactions without autostore, but we need discuss more about things in this patch: 1) load ClassMolder based on value (maybe solves other issues for troubles with polymorphism), see patch to better understand. 2) who needs control bidirectional references, user or Castor, if Castor who deal with it, when user control the bidirectional references like in this patch? note: in creation of this testCase if found more two issues one with dirty=ignore and other with rollback of timestamps, I will make a more simple testCase for both after. and create new ISSUES,
Hide
Clovis Wichoski added a comment -

I dont mention that the attached testCase pass in all test of JDO CTF,

Show
Clovis Wichoski added a comment - I dont mention that the attached testCase pass in all test of JDO CTF,
Hide
Ralf Joachim added a comment -

I removed some of the database constraints as they made it imposible to remove car/order tables. I also removed not null constraint at OrderItem and modified testRemoveDataComplexBidirectional() mthod to allow to remove the test records. I only modified mysql.sql script but changes need to be applied also to sapdb.sql script.

Still tests could not be run suggessfull at the first run as the removeXxxx() methods fail at the first execution. This needs to be changed. I'm also not sure if we cover all usecases as bidirectional 1:n relation is only tested between classes that depend on each other (Order / OrderItem).

I did not have time to look at your modifications at ClassMolder and PersistanceCapableRelationResolver yet.

In addition I miss a comment from Werner

Show
Ralf Joachim added a comment - I removed some of the database constraints as they made it imposible to remove car/order tables. I also removed not null constraint at OrderItem and modified testRemoveDataComplexBidirectional() mthod to allow to remove the test records. I only modified mysql.sql script but changes need to be applied also to sapdb.sql script. Still tests could not be run suggessfull at the first run as the removeXxxx() methods fail at the first execution. This needs to be changed. I'm also not sure if we cover all usecases as bidirectional 1:n relation is only tested between classes that depend on each other (Order / OrderItem). I did not have time to look at your modifications at ClassMolder and PersistanceCapableRelationResolver yet. In addition I miss a comment from Werner
Hide
Clovis Wichoski added a comment -

question to think, I will numerate for us better discuss:

1) But if the constraint in database cant be removed? e.g: this is a requirement for the system, and DBA dont allow that, he is the master,
the testRemoveDataComplexBidirectional are write with this thing in head, when, constraint in database cant be changed.

2) The remove appears first, just to look how the data stay in database after tests ends, the order can be changed without problem. (its because troubles with dirty explained at CASTOR-1206).

3) About relations, this testCases shows the user controling relations, then new doubts appears, we can put the control of relations inside Castor, but how deal with that when the user control the relations like in this testCase?

4) About autoload of relations, how deal with that, when the user do e.g: (assumes that OrderItem dont depend of Order) user executes
db.update(Order) and for each OrderItem of this Order executes db.update(orderItem) and db.update(orderItem.myProduct), the user put objects in wrong order, then the autoload will load objects that will be updated after in same transaction, we may have a Priority control here, like for executing SQL statements?

5) About ClassMolder and PersistanceCapableRelationResolver I loaded the ClassMolder of PersistenceCapable based in Class of value, this way we get the correct ClassMolder for value, before, only gets ClassMolder based on map, this works well if we dont have Class hierarchy, with Class hierarchy we get wrong results. then checking value solves many things, maybe this idea solves other troubles with hierarchy in Castor. and change the name of same variables and parameters for the code became more readable.

Show
Clovis Wichoski added a comment - question to think, I will numerate for us better discuss: 1) But if the constraint in database cant be removed? e.g: this is a requirement for the system, and DBA dont allow that, he is the master, the testRemoveDataComplexBidirectional are write with this thing in head, when, constraint in database cant be changed. 2) The remove appears first, just to look how the data stay in database after tests ends, the order can be changed without problem. (its because troubles with dirty explained at CASTOR-1206). 3) About relations, this testCases shows the user controling relations, then new doubts appears, we can put the control of relations inside Castor, but how deal with that when the user control the relations like in this testCase? 4) About autoload of relations, how deal with that, when the user do e.g: (assumes that OrderItem dont depend of Order) user executes db.update(Order) and for each OrderItem of this Order executes db.update(orderItem) and db.update(orderItem.myProduct), the user put objects in wrong order, then the autoload will load objects that will be updated after in same transaction, we may have a Priority control here, like for executing SQL statements? 5) About ClassMolder and PersistanceCapableRelationResolver I loaded the ClassMolder of PersistenceCapable based in Class of value, this way we get the correct ClassMolder for value, before, only gets ClassMolder based on map, this works well if we dont have Class hierarchy, with Class hierarchy we get wrong results. then checking value solves many things, maybe this idea solves other troubles with hierarchy in Castor. and change the name of same variables and parameters for the code became more readable.
Hide
Ralf Joachim added a comment -

to 1) at your application you may set whatever constraint you like but should also take into account that some can prevent records to be deleted at all. If you have set such constraints it will also be imposible for castor to delete them. As our test cases need to be executed multiple times without creating a new database such constraints are not acceptable here. E.g. there had been no way to delete an order or orderItem with the constraints you have set. Having said that there also may be combinations of constraints that would allow to delete records with SQL statements but castor can not handle.

to 2) i suggest the following order for your test:
1. remove table entries with passthrough SQL statments not throwing excdeptions when tables are empty
2. create your test data
3. execute update tests
4. remove your test data (the remove method as it currently is)
With this you always have the same test conditions even if something fails at steps 2, 3 or 4. If you like to see data in tables you may comment to execute step 4.

3) to 5) I do not understand that

Show
Ralf Joachim added a comment - to 1) at your application you may set whatever constraint you like but should also take into account that some can prevent records to be deleted at all. If you have set such constraints it will also be imposible for castor to delete them. As our test cases need to be executed multiple times without creating a new database such constraints are not acceptable here. E.g. there had been no way to delete an order or orderItem with the constraints you have set. Having said that there also may be combinations of constraints that would allow to delete records with SQL statements but castor can not handle. to 2) i suggest the following order for your test: 1. remove table entries with passthrough SQL statments not throwing excdeptions when tables are empty 2. create your test data 3. execute update tests 4. remove your test data (the remove method as it currently is) With this you always have the same test conditions even if something fails at steps 2, 3 or 4. If you like to see data in tables you may comment to execute step 4. 3) to 5) I do not understand that
Hide
Clovis Wichoski added a comment -

added a new patch, with new idea now only changes few lines of org.castor.persist.resolver.PersistanceCapableRelationResolver and testCase pass.

All CTF tests pass too.

for me with this new patch this issue can be closed, werner, ralf, what you think?

notes about questions above:
the question 1) is maybe a trouble of design or deploy, and dont for castor, then dont be needed anymore.
for question 2) the order of testCases are correct now.
This patch solves question 3) and 4), since the way that autoload has changed, autoload only when user call commit.
for 5) old patchs maybe interesting to be checked for what ClassMolder must be loaded based on Class of value.

Show
Clovis Wichoski added a comment - added a new patch, with new idea now only changes few lines of org.castor.persist.resolver.PersistanceCapableRelationResolver and testCase pass. All CTF tests pass too. for me with this new patch this issue can be closed, werner, ralf, what you think? notes about questions above: the question 1) is maybe a trouble of design or deploy, and dont for castor, then dont be needed anymore. for question 2) the order of testCases are correct now. This patch solves question 3) and 4), since the way that autoload has changed, autoload only when user call commit. for 5) old patchs maybe interesting to be checked for what ClassMolder must be loaded based on Class of value.
Hide
Ralf Joachim added a comment -

Updated patch fixing some problems at testcase.

Show
Ralf Joachim added a comment - Updated patch fixing some problems at testcase.
Hide
Ralf Joachim added a comment -

Final patch with test case integrated into cpa test suite. Every test of cpa passes.

Show
Ralf Joachim added a comment - Final patch with test case integrated into cpa test suite. Every test of cpa passes.
Hide
Ralf Joachim added a comment -

Reopend to change component.

Show
Ralf Joachim added a comment - Reopend to change component.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
Not Specified
Original Estimate - Not Specified
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
5h 20m
Time Spent - 5 hours, 20 minutes