-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Sharing session factory between multiple webapps
PostPosted: Wed Jun 15, 2005 11:32 am 
Newbie

Joined: Wed Jul 14, 2004 10:39 am
Posts: 4
Location: Switzerland
Hello,

Maybe someone can help me, because i am quite confuse. I have an hibernate web application, i have used as recommended the local SessionFactory HibernateUtil strategy to get the SessionFactory, this worked perfectly.
Now i have to build a second webapp using exactly the same mappings as the first one. I was wondering if i stick to the HibernateUtil strategy or i use a sessionFactory bound to jndi, that would be accessible from both application.
What i think is that I have to pack all my mappings and classes in a jar that i put in the WEB-INF/lib directory of my two webapplication. But isn't this going to duplicate hibernate initialization, with two sessionFactory being loaded in each webapplication ? won't it duplicate also the session cache and second level cache?
What is the best use case, share a single SessionFactory through jndi or use local SessionFactory in HibernateUtil ?
I don't need to use JTA, or CMT or anything like this. So actually i would use a container like jboss just for jndi and mbean capability if the jndi solution is required to share SessonFactory instance between my webapps. But if someone has another solution to share the same mappings and dao through webapps i would really appreciate the help.

Thanks a lot for any help

Numito


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 20, 2007 8:57 am 
Newbie

Joined: Mon Jun 26, 2006 4:52 am
Posts: 8
Hello

Let's revive an old post.

I have the same design interrogation .. two webb app sharing the same DB.
What's the best practice to implement to share the session factory and the cache between those two ?

Numito, how did you proceed ?

Many thanks!
Julien


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.