db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Watzek <mwa.t...@spree.de>
Subject Lifecycle listener events concerning store/delete
Date Wed, 23 Nov 2005 10:56:35 GMT
Hi Andy,

I'm implementing test cases for deletion by query. Assertion A14.8-4 
specifies (amongst others) that dirty instances are flushed to the 
datastore before they are deleted.

The test case implementing this assertion adds a lifecycle listener to 
the persistence manager. The listener checks the order of events fired 
by JPOX. The test case fails if store events are fired after the first 
delete event was fired.

JPOX fires the right order of events when instances are involved not 
having any relationships. Involving instances having relationships JPOX 
does not stick to that order.

For example:

The test case updates all employees. Afterwards, it deletes these 
employees using Query.deletePersistentAll inside the same transaction. 
If the test case uses employees having relationships, it appears, that 
some store events are fired between preDelete and postDelete events 
fired on the same instance. On the other hand, if the test case uses 
employees without relationships the order of events meets the spec. 
Please have a look below.

Is the different event handling concerning relationships intentional?

Regards,
Michael

Events fired on persons without relationships:
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 5
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 5
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 5
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 5


Events fired on persons with relationships:
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 5
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 5
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 5
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 5
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 1
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] preStore event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] postStore event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 2
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 3
     [java] preDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 4
     [java] postDelete event: org.apache.jdo.tck.pc.company.Person$Oid: 4
-- 
-------------------------------------------------------------------
Michael Watzek                  Tech@Spree Engineering GmbH
mailto:mwa.tech@spree.de        Buelowstr. 66
Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
Fax.:  ++49/30/217 520 12       http://www.spree.de/
-------------------------------------------------------------------

Mime
View raw message