• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about entity bean lifecycle

 
william shen
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

i am new to the EJB world, i created a sample entity bean which is accessed through a stateless session bean. it seems like everytime i called the findByPrimaryKey method on the entity bean, it created a new instance of the bean even i called findByPrimaryKey with exactly the same key. is it normal, or i did something wrong. coz, why does the container create new instance of the bean everytime instead of reusing the same instance to save memory? can somebody clear this out for me? thanks in advance.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling findByPrimaryKey results in the invocation of ejbFindByPrimaryKey, which returns the primary key type. This is not the same as a bean instance. The primary key maps to a either a single field or multiple fields in the entity bean class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic