About Question enthuware.oce-jpad.v6.2.421 :

Moderator: admin

Post Reply
Posts: 1
Joined: Tue May 23, 2017 1:05 pm

About Question enthuware.oce-jpad.v6.2.421 :

Post by Susmit »

@Entity public class LifecycleCallbackTestEntity implements Serializable {
// attributes and accessor methods not shown

@PostPersist public void m1(){

@PostUpdate public void m2(){

What will be printed when an application performs the following steps -
1. Begins a transaction 2. Creates the entity 3. Persists the entity 4. Updates the entity 5. Updates the entity again 6. Commits the transaction

Please help me out with the proper reason

Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm

Re: About Question enthuware.oce-jpad.v6.2.421 :

Post by himaiMinh »

The @PostPersist will be called. But it is up to the persistence provider to call @PostUpdate.
The spec says that an entity is persisted, the provider may or may not call the pre/post update in the same transaction.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest