Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Entity bean questions

 
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
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • 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.
 
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
 
Cowgirl and Author
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
 
Whatever. Here's a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic