Could you provide example how to pass entity by value?otherwise passing an entity by value
About Question enthuware.oce-jpad.v6.2.599 :
Moderator: admin
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
About Question enthuware.oce-jpad.v6.2.599 :
-
- Site Admin
- Posts: 10045
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.599 :
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.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.599 :
That will require serialization?
-
- Site Admin
- Posts: 10045
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.599 :
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.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.599 :
So that would mean that entities are required to implement Serializable, but as I see provider does not enforce that.
-
- Site Admin
- Posts: 10045
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.599 :
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.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.599 :
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.
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.
-
- Site Admin
- Posts: 10045
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.599 :
OK, I missed reading that. Thanks for sharing.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.
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 197
- Joined: Mon Jun 20, 2016 5:06 pm
- Contact:
-
- Posts: 358
- Joined: Fri Nov 29, 2013 8:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.599 :
In the explanation
I think it is better to put "from closing an application managed entity manager" because we cannot explicitly close the container managed entity manager.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.
Who is online
Users browsing this forum: No registered users and 31 guests