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

Moderator: admin

Post Reply
johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

otherwise passing an entity by value
Could you provide example how to pass entity by value?

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

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

Post by admin »

It already specifies an example, "e.g. to a separate application tier, through a remote interface, etc.".
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

That will require serialization?

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

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

Post by admin »

Yes, serialization is one mechanism which can be used to achieve pass by value semantics for objects.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

So that would mean that entities are required to implement Serializable, but as I see provider does not enforce that.

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

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

Post by admin »

It does not impose any restriction either about serializing them. Also, serialization is only one such mechanism. You could use your own custom mechanism to transfer the state of an object to another process and initialize a copy there using that state.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

Specification says:

If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the entity class must implement the Serializable interface.

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

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

Post by admin »

johnlong wrote:Specification says:

If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the entity class must implement the Serializable interface.
OK, I missed reading that. Thanks for sharing.
Paul.
If you like our products and services, please help us by posting your review here.

johnlong
Posts: 185
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

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

Post by johnlong »

Thanks.

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

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

Post by himaiMinh »

In the explanation
A detached entity results from transaction commit if a transaction-scoped container-managed entity manager is used (see section 3.3); from transaction rollback (see section 3.3.2); from detaching the entity from the persistence context; from clearing the persistence context; from closing an entity manager; or from serializing an entity or otherwise passing an entity by value—e.g., to a separate application tier, through a remote interface, etc.
I think it is better to put "from closing an application managed entity manager" because we cannot explicitly close the container managed entity manager.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests