-->
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.  [ 4 posts ] 
Author Message
 Post subject: JBoss doesn't allow 2 different hibernate sessions
PostPosted: Fri Feb 24, 2006 12:36 pm 
Newbie

Joined: Thu Feb 23, 2006 5:00 pm
Posts: 2
After some tweaking, I finally got the tutorial from hibernate's website to work. In it, a java servlet takes some some user input and stores it in a HSQL database. When I run this in Jboss, it works fine.

I created a second version in which the end database is MS SQL Server. That works fine as well.

But, when I run both versions at the same time (in 2 separate browser windows), everything gets crossed. That is, whichever version I launch first, that's the database where all the user input ends up. It's as though only 1 hibernate.cfg.xml file can exist at one time.

When I run both versions simultaneously through Resin, the problem goes away. So, it looks like in JBoss, some configuration needs to be done. The two versions are running in their own separate war files, so I can't figure out why the two versions are getting crossed. Any ideas?


The tutorial can be found at:
http://www.hibernate.org/hib_docs/v3/re ... orial.html


To download the source code for the tutorial directly (it requires tweaking to work):
http://www.hibernate.org/hib_docs/v3/reference/tutorial


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 1:02 pm 
Regular
Regular

Joined: Wed Feb 08, 2006 3:59 pm
Posts: 75
If you use Hibernate inside JBoss, you should use Hibernate MBean. You'll get the Session Factory through JNDI instead of "new Configuration().configure().buildSessionFactory()".

To deploy several SessionFactories, just bind them to different JNDI names (as specified in the MBean descriptor).

More information here :
http://docs.jboss.org/jbossas/jboss4guide/r2/html/ch13.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 1:15 pm 
Newbie

Joined: Thu Feb 23, 2006 5:00 pm
Posts: 2
Thanks, but we need a non JBoss-specific implementation since we may go with a different container.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 2:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
lookup jboss classloader scoping.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.