[jboss-user] [EJB 3.0] - Re: @PrePersist @PreUpdate within @AroundInvoke results in c

centecbertl do-not-reply at jboss.com
Fri Dec 1 10:57:19 EST 2006


Hi,

according to the specification (Ejb-3_0-spec-persistence.pdf chapter 3.5.2) the behaviour of @PrePersist and @PreUpdate may be different.

in short words (trying to keep the meaning correct)

@PrePersist and @PreRemove are called before the EntityManger methods persist and remove are executed on the Entity. (leaving out details on merging here! -> thus your code shows "prepersist" before "procedd"

@PreUpdate is defined differently, though. It occurs before the database operation. The database operation is not exactly scheduled. It can occur due to a flush, or at the end of the transaction -> which is after the try clause 
in your code -> so the ordering of the "preupdate" and "proceed" messages in  the result output is correct, but not guaranteed.

kr.
Bertl

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990476#3990476

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990476



More information about the jboss-user mailing list