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

Moderator: admin

Post Reply
Guest

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

Post by Guest »

Why is A true !?

The question says:

A new entity instance is the one that has a corresponding row in the database table but is not synchronized with it. (this is not true as far as I know)

The explanation says:
A new entity instance is the one that does not have a corresponding row in the database table...

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

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

Post by admin »

The question asks you to select wrong statements, that is why option 1 is correct.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

pagarciaortega
Posts: 3
Joined: Mon Jul 22, 2013 11:10 pm
Contact:

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

Post by pagarciaortega »

Hi,

for me the term 'new entity' is confusing, because that exact term is used to represents entities that have not been persisted yet.

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

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

Post by admin »

Yes, it is used in the same sense in option 1.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

__JJ__
Posts: 125
Joined: Thu Jul 05, 2018 6:44 pm
Contact:

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

Post by __JJ__ »

A managed entity instance is the one that has a corresponding row in the database table and is also synchronized with it.
Is this not incorrect? I thought a managed entity is one that exists in the persistence context; it may or may not have a corresponding row in the database; it may or may not be synchronized with the db; as far as I am aware, synchronization with the db means committing:
3.2.4 Synchronization to the Database
The state of persistent entities is synchronized to the database at transaction commit. This synchronization
involves writing to the database any updates to persistent entities and their relationships as specified
above.
Furthermore AFAIK any entity may be managed by an extended PC that is not even connected to a transaction so quite possibly won't we anywhere near synchronized to the db, so why is it not possible for an entity to be managed but either not in the db or not synchronized with it?

em.find(someobj, 1L) => someobj is managed; change someobj; it's still managed, but it's not in synch with the db. So this sentence is wrong.
Or am I wrong?
Thanks.

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

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

Post by admin »

As per section 3.2 of JPA Spec:
A new entity instance has no persistent identity, and is not yet associated with a persistence context.
A managed entity instance is an instance with a persistent identity that is currently associated with a persistence context.
A detached entity instance is an instance with a persistent identity that is not (or no longer) associated with a persistence context.
A removed entity instance is an instance with a persistent identity, associated with a persistence context, that will be removed from the database upon transaction commit.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests