Brian McCallister <mccallister <at> forthillcompany.com> writes:

> Are you using an instance of the object obtained during a different  
> transaction?
> 
> for instance:
> 
>      public void testRemoveChildren()
>      {

[ ... store objects ... ]

>          Transaction tx = kit.getTransaction(otmConnection);
>          tx.begin();
>          parent.removeChild(child2);
>          tx.commit();

[ ... asserts ... ]

>      }
> 
> Will fail
> 
>      public void testRemoveChildren()
>      {

[ ... store objects ... ]

>          Transaction tx = kit.getTransaction(otmConnection);
>          tx.begin();
>          parent = (Parent)  
> otmConnection.getObjectByIdentity(otmConnection.getIdentity(parent));
>          child2 = (Child)  
> otmConnection.getObjectByIdentity(otmConnection.getIdentity(child2));
>          parent.removeChild(child2);
>          tx.commit();

[ ... asserts ... ]

>      }
> 
> Will pass. The objects need to be bound to the current tx.
> 
> where store begins a transaction, stores, and then commits the  
> transaction.
> 
> -Brian

Hello Brian,

I don't know if I understand you correctly as the above seems to be
contradicting to Oleg's patches. The recent version of DependentTests reflects
my wishes at best I guess [1]. I want to modify the objects outside of any
transaction (Cocoon Forms/Woody does it for me) and make the changes persistent
afterwards (the obects are given back to the data access layer). Of course it's
possible that I need better identity handling to delete/update correctly my
objects and its dependencies in my application. For that reason I used the OJB
tests to show the effects I have and until now I could reproduce my problems
there. If you think the current version of DependentTests is invalid please tell
me - maybe Oleg has already to much fixed then.

Joerg

[1] http://cvs.apache.org/viewcvs.cgi/db-ojb/src/test/org/apache/ojb/otm/
DependentTests.java?rev=1.4&view=markup


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to