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
|