Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

entity state question

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in a application or container managed entity manager with persistenctype = extended, if a entity is deleted, is it detached? if it is dettached, is there a way to reattached it back
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

jim li wrote:in a application or container managed entity manager with persistenctype = extended, if a entity is deleted, is it detached? if it is dettached, is there a way to reattached it back



If we go by the LIFE CYCLE of an Entiry Instance then when you delete an entity it goes from 'Managed' State to 'Removed' state (you will use remove methond ).
it does not go to 'Detached ' State.
and again according to the LIFE CYCLE if an Entity is in 'Removed' State you can restore it by again Calling persist method.


I think LIFE CYCLE Should be same regardless of which scope you use(normal or extended)
So i THINK it applies to your question also.

if a entity is deleted, is it detached? No I think it is in Removed state.
f it is dettached, is there a way to reattached it back YES You could have had done that using merge method again but if it would have in DETACHED remember it is in Removed State.

You may try this practically........

 
We can walk to school together. And we can both read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic