• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Remove Vs Managed Instance

 
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.
 
Creator of Enthuware JWS+ V6
Posts: 3292
296
Android Eclipse IDE Chrome
  • 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.
 
What are you doing? You are supposed to be reading this tiny ad!
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!