I am confused with third option.
[Option] The customer with primary key matching custID has become detached.
[Explanation] In this case, the customer will become managed again.
That is wrong. If the entity is detached, only the calling persist() can make it managed again.
The calling find() will return null.
About Question enthuware.oce-jpad.v6.2.484 :
Moderator: admin
-
- Posts: 39
- Joined: Thu Jan 29, 2015 4:49 pm
- Contact:
-
- Site Admin
- Posts: 10045
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.484 :
Why do you think so?
find cannot return null if a row exists in the database.
find cannot return null if a row exists in the database.
If you like our products and services, please help us by posting your review here.
-
- Posts: 39
- Joined: Thu Jan 29, 2015 4:49 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.484 :
Can it be that the entity is removed from database(during commit of pre transaction) and it then stays as detached in EM? Calling find() on such EM will return null or not ?admin wrote:Why do you think so?
find cannot return null if a row exists in the database.
-
- Site Admin
- Posts: 10045
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.oce-jpad.v6.2.484 :
Yes, but deletion is not the only cause for detachment. You could just detach an entity from the entity manager by calling em.detach(entityRef) also.
So just because an entity is detached doesn't necessarily mean that find will return null.
HTH,
Paul.
So just because an entity is detached doesn't necessarily mean that find will return null.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 18 guests