• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

about Entity instance lifecycle

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
third question about Entity's lifecycle,give answer is D,how about B and C,can anyone explain those two statements.thanks

Which statement about an entity instance lifecycle is correct?
A. A new entity instance is an instance with a fully populated state.
B. A detached entity instance is an instance with no persistent identity.
C. A removed entity instance is NOT associated with a persistence context.
D. A managed entity instance is the instance associated with a persistence context.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A is not good because entity is in "new" state after statement
EntityClass object = new EntityClass();
so it can have no state available (no persistence identity also)

B is not good because "detached" state means that entity is no longer available in persistence context, but it was before, so it has persistence identity

C is not good because "removed" entity is still associated with persistence context because the persistence context has to make database operations to physically remove db row from database.
 
This is my favorite tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic