-->
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.  [ 5 posts ] 
Author Message
 Post subject: Session.connection() deprecation
PostPosted: Thu Jul 03, 2008 7:34 am 
Newbie

Joined: Thu Jul 03, 2008 7:28 am
Posts: 2
Session.connection() is deprecated (I'm using Hibernate 3.2.6.ga). Corresponding comment in sources says:
"@deprecated To be replaced with a SPI for performing work against the connection; scheduled for removal in 4.x"
I'm not a big expert in Hibernate and its internals. Can anyone give a hint: what should I use if I need to get a Connection from the Session instance?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 8:27 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
There is the Session.doWork() method. This is useful if you, for example, want to execute some SQL with JDBC and then return. It is not useful if you need to keep on to the connection for later use. The docs say something about this to be done in the future. In the meantime you'll have to hang on to Session.connection().


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 9:00 am 
Newbie

Joined: Thu Jul 03, 2008 7:28 am
Posts: 2
Thanks for the hint. Looks like Hibernate developers have deprecated connection() method a bit too early as this doWork() method is not in current production version yet...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 03, 2008 9:38 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Oh, my mistake... I remembered seeing something about this and assumed it was in the latest 3.2 version. I checked again and it seems like it was added in 3.3.0.cr1: http://sourceforge.net/project/shownote ... p_id=40712

We'll, I guess we both have to live with the compilation warnings for some time.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 04, 2008 1:37 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Indeed. It's in there!

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


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