@Entity public class LifecycleCallbackTestEntity implements Serializable {
// attributes and accessor methods not shown
@PostPersist public void m1(){
System.out.println("X");
}
@PostUpdate public void m2(){
System.out.println("Y");
}
}
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
About Question enthuware.oce-jpad.v6.2.421 :
Moderator: admin
-
- Posts: 1
- Joined: Tue May 23, 2017 1:05 pm
- Contact:
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.421 :
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.
The spec says that an entity is persisted, the provider may or may not call the pre/post update in the same transaction.
Who is online
Users browsing this forum: No registered users and 27 guests