-->
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.  [ 3 posts ] 
Author Message
 Post subject: Multiple co-existent Sessions on the same JDBC Connection
PostPosted: Thu Jul 22, 2004 4:48 am 
Newbie

Joined: Wed May 19, 2004 3:50 am
Posts: 11
Hi,

I have an unusual Hibernate usage scenario (client-side) in which it would be advantagous to create more than one Hibernate Session attached the same JDBC connection. The architecture I have will guarantee that these Sessions are never used concurrently from different threads - i.e. I will never have concurrent transactions in progress. I have very good reasons for needing to do this, but won't go into the details of design here.

In the Hibernate documentation it says:

"Never create more than one concurrent Session or Transaction instance per database connection".

It is unclear to me whether this means you cannot [i]instantiate[/i] more than one Session on the same JDBC connection, or whether this is merely talking about concurrent usage, which is obviously not going to work.

Since JDBC connections are basically stateless, I am hoping that I can try this usage pattern out.

Is this possible, or is there code in SessionImpl etc... that depends on there only being one Session attached to a given JDBC connection?


Tom.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 4:52 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Using several Sessions on the same JDBC connection is a well known and accepted trick in some scenarios. You shouldn't do this concurrently, of course.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 4:55 am 
Newbie

Joined: Wed May 19, 2004 3:50 am
Posts: 11
Great stuff. That's just what I wanted to hear.

Thanks for the instant reply - that's what I call service! :-)


Tom.


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