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

Moderator: admin

Post Reply
NightCapybara
Posts: 3
Joined: Sat Aug 29, 2015 1:30 pm
Contact:

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

Post by NightCapybara »

There are two completely identical answers.
X
Y
Y

X

X
Y

X
Y

admin
Site Admin
Posts: 8913
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

No, I see that the third option is YY.
If you like our products and services, please help us by posting your review here.

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

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

Post by himaiMinh »

Hi, everyone,
According to the spec section 3.5.2:
For entities to which the merge operation has been applied and causes the creation of newly managed instances, the
PrePersist callback methods will be invoked for the managed instance after the entity state has
been copied to it.
I think when the merge is called in this case, the PrePersist should be called according to the spec.
Any comments?

admin
Site Admin
Posts: 8913
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

From what you have quoted, "For entities to which the merge operation has been applied and causes the creation of newly managed instances,..."
In this question, the merge operation does not cause the creation of a new entity. So why do you expect PrePersist to be called?
Paul.
If you like our products and services, please help us by posting your review here.

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

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

Post by himaiMinh »

I tried with Eclipselink. If X is a new entity that does not exist in the database, a entityManager.merge (x); statement will create and persist that entity. Then, the Pre/post Persist is called.

But that may be only happening in Eclipselink.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests