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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
Rollebol
Posts: 5
Joined: Tue Jan 12, 2016 12:47 pm
Contact:

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

Post by Rollebol »

Is the merge operation really needed here?

The fact that EntityTransaction is used, implies the use of a resource-local entity manager.
A resource-local entity manager is always application-managed (because non-JTA transactions cannot be container-managed).
Furthermore, an application-managed entity manager always manages an extended persistence context.
That means that the lcte object is still managed by the entity manager after the first commit and the merge operation can be omitted (but it wouldn't hurt to leave it in).

Is this information worth adding to the explanation?

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

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

Post by admin »

Very sorry for late reply.
Rollebol wrote:Is the merge operation really needed here?

The fact that EntityTransaction is used, implies the use of a resource-local entity manager.
A resource-local entity manager is always application-managed (because non-JTA transactions cannot be container-managed).
That is correct.
Furthermore, an application-managed entity manager always manages an extended persistence context.
That means that the lcte object is still managed by the entity manager after the first commit and the merge operation can be omitted (but it wouldn't hurt to leave it in).
Yes, this is correct as well.
The only benefit of calling merge is that the merge operation will be cascaded to entities referenced by relationships from the entity if these relationships have been annotated with the cascade element value cascade=MERGE or cascade=ALL annotation. (Not applicable in this question because LifecycleCallbackTestEntity doesn't reference any other entities.)
Is this information worth adding to the explanation?
Added.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.

Rollebol
Posts: 5
Joined: Tue Jan 12, 2016 12:47 pm
Contact:

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

Post by Rollebol »

Thank you for your excellent reply!

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests