-->
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.  [ 2 posts ] 
Author Message
 Post subject: reconnect deprecated
PostPosted: Tue Jan 17, 2006 7:34 pm 
Newbie

Joined: Fri Nov 25, 2005 10:01 pm
Posts: 7
In Hibernate in Action, the authors recommend
the following servlet filter for long sessions (chapter 8),
but in Hibernate 3.1, I get:

warning: reconnect() in org.hibernate.Session has been deprecated

what changed? Should I not use this, or use a different
reconnect()?

public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
// Try to get a Hibernate Session from the HttpSession
HttpSession userSession =
((HttpServletRequest) request).getSession();
Session hibernateSession =
(Session) userSession.getAttribute("HibernateSession");
// and reconnect it to the current thread
if (hibernateSession != null)
HibernateUtil.reconnect(hibernateSession);
try {
chain.doFilter(request, response);
// Commit any pending database transaction.
HibernateUtil.commitTransaction();
} finally {
// Disconnect the Session
hibernateSession = HibernateUtil.disconnectSession();
// and store it in the user's HttpSession
userSession.setAttribute("HibernateSession", hibernateSession);
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 4:11 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
This seems to be the reason:

http://forum.hibernate.org/viewtopic.php?t=951059

hope this helps.

_________________
dont 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.  [ 2 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.