The bug is fixed. And, tests are added to avoid reoccurrence in the future.

Thank for reporting.
For faster response in the future, please remember to make us test cases
base on the existing tests and send us the diff.



Thomas

-----Original Message-----
>From: Tim Fox [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, September 09, 2001 7:28 AM
>To: [EMAIL PROTECTED]
>Subject: [castor-dev] Bug in object deletion with lazy loading
>
>Sorry guys - I seem to have found another bug :(
>
>
>If I have classes A and B
>
>There is a one-many relation between A and B - this relationship is flagged
>as lazy in the mapping.xml
>Ie. A is associated with many B's.
>
>Now, I load an instance of class B (using db.load), this causes an instance
>of class A to load too, since B is associated with an instance of class A.
>
>Fine.
>
>Since the one-many relationship is lazy, this *doesn't* cause all the B's
>associated with the instance of A to load at this time.
>
>I now attempt to delete B (using db.remove) -
>One of the first things that happens is that B is marked as deleted
>(.deleted is set to true).
>Later on the relation (RelationCollection) for the one-many is iterated
>through - to mark it is as deleted - since it is lazy - this causes all the
>instances of B referenced in the collection to be loaded only now.
>
>One of those instances (clearly) is the original instance of B that we are
>deleting - but it has already been marked as deleted!! Hence the following
>line of code is triggered and we get an exception:
>
> if ( entry.deleted )
>                throw new ObjectNotFoundException( "Object is deleted" +
>molder.getName() + identity );
>
>(from TransactionContext.java)
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>        unsubscribe castor-dev
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to