Hi, I tried also a simple example and saw it working... 

The problem arose when I was trying to use Compass with OpenJPA. It has
embedded support for OpenJPA, hooking on to lifecycle events to
transparently index persisted information.

A Compass unit test uses an entity class with a manually set id. When I
changed the annotation in the Entity class to GeneratedValue, and commented
out the manual id setting, the test failed. I opened a thread on Compass
Support
(http://forum.compass-project.org/thread.jspa?threadID=215882&tstart=15).
Shay Banon said Compass was hooking into PostPersist event. 

Looking at it again, it appears that maybe the mistaken assumption is in
Compass (that PostPersist is called after em.persist?), or else I have made
some mistake in configuration. Apologies for wasting your time if that is
the case. 

In case you are interested, here is the test class:

http://svn.compass-project.org/svn/compass/trunk/src/main/test/org/compass/gps/device/jpa/openjpa/OpenJPASimpleJpaGpsDeviceTests.java

which inherits a simple test from

http://svn.compass-project.org/svn/compass/trunk/src/main/test/org/compass/gps/device/jpa/AbstractSimpleJpaGpsDeviceTests.java

which uses this entity class "Simple":

http://svn.compass-project.org/svn/compass/trunk/src/main/test/org/compass/gps/device/jpa/model/Simple.java

However, what's vital to know is not apparent there (where/how exactly the
compass code hooks in). maybe you will know how that must be? Anyway, I will
keep trying to figure it out. Thanks for your responses.


-- 
View this message in context: 
http://n2.nabble.com/Generated-primary-key-values-are-available-in-the-PostPersist-method---tp2142933p2147480.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to