-->
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.  [ 8 posts ] 
Author Message
 Post subject: deprecation:org.hibernate.Session.connection()
PostPosted: Sun Aug 12, 2007 11:36 am 
Newbie

Joined: Fri Jun 08, 2007 3:16 am
Posts: 11
I use Connection conn = this.getSession().connection(),but when I compile it,it says:
[deprecation] connection() has deprecation under org.hibernate.Session
Then I looked up hibernate-3.2 api,it says:
Connection connection() throws HibernateExceptionDeprecated. To be replaced with a SPI for performing work against the connection; scheduled for removal in 4.x

I don't know how to "replaced with a SPI for performing work against the connection"? Anyone could give me a example to do it?

Thanks!


Last edited by Edward King on Sun Aug 12, 2007 8:47 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 12, 2007 2:11 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
"To be replaced"

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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 12, 2007 8:51 pm 
Newbie

Joined: Fri Jun 08, 2007 3:16 am
Posts: 11
I don't know which method to be used replace connection()?
Would you tell me how to do it? An example is better!
Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 13, 2007 12:41 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
"TO BE".

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 13, 2007 8:34 am 
Newbie

Joined: Mon Aug 13, 2007 8:30 am
Posts: 1
Edward, what Christian means is that there is currently no other method that you can use instead. In a future version of Hibernate there will be something that replaces the connection() method, but it is not yet available in Hibernate 3.2.5.

So you just have to live with the deprecation at this moment. In the future, when there's a different way to get to the connection, you can use that new way, but it isn't available yet.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 13, 2007 10:06 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
just FYI, they are going to create a method which doesn't expose the connection (so much) so the connection/session management can stay within control of hibernate and your connection manager implementation instead of letting you manually use it and potentially create connection leaks or deadlock db connections.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject: why deprecated?
PostPosted: Sat Apr 05, 2008 7:11 pm 
Newbie

Joined: Tue Dec 06, 2005 10:13 am
Posts: 17
Wouldn't it be best to declare deprecation only when there is a new replacing method?


Top
 Profile  
 
 Post subject: Re: deprecation:org.hibernate.Session.connection()
PostPosted: Thu Jun 10, 2010 1:08 pm 
Newbie

Joined: Thu Jun 10, 2010 12:46 pm
Posts: 1
If your hibernate is auto-commit true,
you could circle your operations with doInHibernate ,
and it will guerentee it will commit it when the session is done.


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