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

Moderator: admin

Post Reply
cosminvacaroiu

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

Post by cosminvacaroiu »

What's the difference of a new entity and a detached entity ? If for example the id isn't set as generated, it is written explicitly and the new entity has an Id set. How does he make the difference ?

study
Posts: 1
Joined: Mon Jan 07, 2013 3:09 pm
Contact:

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

Post by study »

• A new entity instance has no persistent identity, and is not yet 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.

Sect 3.2 of JSR317 Specification

Object identity does not equal Persistent identity

ramy6_1
Posts: 124
Joined: Wed Feb 12, 2014 2:44 am
Contact:

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

Post by ramy6_1 »

Hello ,

Regarding option two "If entityObject is already removed, IllegalStateException will be thrown."

I can't understand what is the difference between remove and detach , I think removing entity instance make it detached (Un managed by the PC).

Please explain

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

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

Post by admin »

Removing an entity means you are removing the corresponding data from the database. Detaching it means the instance is not managed anymore by the persistence context. Detaching doesn't affect the database.
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 41 guests