Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remove Vs Managed Instance

 
Sudhanshu Mishra
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am a bit confused after reading JSR-317 Section 3.2.8(Managed Instances).

As far as I understand, if an entity is associated with a persistence context, it is managed.
And as per the spec: A managed entity instance is an instance with a persistent identity that is currently associated
with a persistence context.

Then why invoking contains on a removed entity will return false?

Please help me understand the concepts.

Many thanks in advance.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2535
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then why invoking contains on a removed entity will return false?

The contains() method retuns false for a removed entity because you have decided that it isn't of use anymore (and on transaction commit the entity will be removed from the database). You are correct that it is still associated with the persistency context, but it won't play any other role than to be deleted from the database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic