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

entity state question

 
jim li
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
 
Dhiren Lodhia
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........

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic