This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity bean questions

 
Vipin Mohan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends
I have some questions about entity beans.
1. Will the handle of an entity bean survive a server crash ? I know that the entity and the primary key will, but what about the handle ?
2. Is there a timeout for entity beans ?
3. Suppose I perform the JNDI lookup on the home interface two times and get two different home objects. If I use each home object to find an entity, by passing the same primary key, will the resulting entity beans return true for an isIdentical() method call ?
Thanks in advance
Vipin
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. Will the handle of an entity bean survive a server crash ? I know that the entity and the primary key will, but what about the handle ?

As per the spec the handle is valid for atleast one server restart.
2. Is there a timeout for entity beans ?

no
. Suppose I perform the JNDI lookup on the home interface two times and get two different home objects. If I use each home object to find an entity, by passing the same primary key, will the resulting entity beans return true for an isIdentical() method call ?

Yup.
 
Joe McIntyre
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that isIdentical() would return true... but isn't there always only one Home Object? (Do you mean two different stubs?)
 
Vipin Mohan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends
Thanks for the answers.
Yes Wally, I meant two different stubs for the same home object.
Thanks
Vipin
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy --
I just wanted to add one more clarification...
When the spec (or the exam) says "from the same home", they mean / we mean "from the same deployment event".
So no matter how many times you do a JNDI lookup on a specific home, or no matter how many *instances* of the "home* (and we don't even know what that really is), the behavior is guaranteed by the spec.
But if you deploy a bean more than once, the second time you deploy it you'll have a different EJB name and a different JNDI name. As far as the Container is concerned, each deployment of a session or entity bean generates a separate 'home', and that home is what determines whether two things are identical (stateless session beans and entities with the same PK).
Of course, there *are* some containers that will let you deploy a bean using a JNDI name that's already in use, but that's just a flaw in the deployment tools. They should NOT allow you to do this, since simply deploying a bean with a JNDI name that's in use does not constitute a real *redeployment* of the bean, and is probably just a mistake. I've seen it happen though... and then what you get back from a JNDI lookup is rather unpredictable (although consistent for the Container that lets you do it).
cheers,
Kathy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic