Announcement Announcement Module
Collapse
No announcement yet.
SLSB caching hibernateSessionFactory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SLSB caching hibernateSessionFactory

    Hi,

    I was wondering what the best method of caching the hibernateSessionFactory in the business layer is.

    I am using SLSB, business pojo (extends AbstractStatelessSessionBean), DAO, Hibernate. Before attempting to introduce a layered architecture, I was storing the hibernateSessionFactory in a static SLSB member variable which renders the state cached - if I understand the SLSB behaviour correctly.

    Question is now, can I do the same with the bizpojo interface and declare it as a static variable.

    Anyone have any idea what the overhead would be like for a few hundred hits per minute max on a jndi-lookup for the hibernateSessionFactory taking place for every request?

    The reason I ask is that I am not sure that the hibernateSessionFactory which is defined in my applicationContext.xml will be cached otherwise.

    Any help is much appreciated.

    Jim

  • #2
    If you want to share a SessionFactory between multiple SLSBs maybe you could have a look at ContextSingletonBeanFactoryLocator.

    Regards,
    Andreas

    Comment


    • #3
      You should not cache the SessionFactory, because it's a singleton. Use the ContextSingletonBeanFactoryLocator with your applicationContext.xml and all of your SLBs will have access to the same instance of the SessionFactory.

      Comment

      Working...
      X