• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

question about entity bean lifecycle

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic