Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and stateless session beans

 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How can I use hibernate to work with session beans, where one stateless session bean invokes a method of another stateless session bean? Is the Hibernate Session started in the first session bean extended to the second session bean?
What are the strategies and/or limitations of using hibernate with session beans in general?

Thanks,
Parag
 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems odd, but, doesn't anyone know about using hibernate and session beans in general?

Parag
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It seems odd, but, doesn't anyone know about using hibernate and session beans in general?

Well, the Hibernate documentation does. A session is:

an inexpensive, non-threadsafe object that should be used once, for a single business process, and then discarded.


Think about how session stateless beans work and how you could get access to a session created in one from another. Passing the session about between EJB methods would crucify performance - since the session is also the first level cache and if the beans are remote the container would have to serialize the entire first level cache to call another method.

The documentation actually says if you are using a session with session beans each business method should open, close and flush a session.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic