aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Entity bean questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Entity bean questions" Watch "Entity bean questions" New topic
Author

Entity bean questions

Vipin Mohan
Ranch Hand

Joined: Nov 15, 2003
Posts: 79
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

Joined: Feb 27, 2002
Posts: 8919

. 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.


Groovy
Joe McIntyre
Ranch Hand

Joined: Nov 20, 2003
Posts: 121
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

Joined: Nov 15, 2003
Posts: 79
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
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Entity bean questions