I have a struts/hibernate webapp that throws exceptions intermittently relating
to the connection handle, eg:
| 2006-05-22 15:04:24,947 DEBUG [org.hibernate.jdbc.JDBCContext] running
Session.finalize()
| 2006-05-22 15:04:24,947 DEBUG [org.hibernate.jdbc.JDBCContext] running
Session.finalize()
| 2006-05-22 15:04:25,913 DEBUG [org.hibernate.transaction.JDBCTransaction]
begin
| 2006-05-22 15:04:25,913 ERROR [org.hibernate.transaction.JDBCTransaction]
JDBC begin failed
| java.sql.SQLException: Connection handle is not currently associated with a
ManagedConnection
| at
org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(Wrapped
| Connection.java:528)
| at
org.jboss.resource.adapter.jdbc.WrappedConnection.getAutoCommit(Wrapp
| edConnection.java:324)
| at
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:
| 49)
| at
org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19)
| at
org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:204)
| at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1014)
| at uk.gov.brightonhove.central.dao.UserDao.getUser(Unknown Source)
| at
uk.gov.brightonhove.central.users.UserAction.setupEditUser(Unknown So
|
I understand that this error indicates I'm trying to use a connection after
it's been closed but I can't work out why this would be the case. BTW, am I
right in thinking
The code in my DAO classes that uses Hibernate looks like:
| try {
| Session session = HibernateUtil.currentSession();
| Transaction tx = session.beginTransaction();
| Query query = session.createQuery("select u from User as u
where u.userid = :id");
| query.setInteger("id", id.intValue());
| u = (User) query.uniqueResult();
| tx.commit();
| HibernateUtil.closeSession();
| } catch (HibernateException he) {
| System.out.println("getUser: "+he);
| }
|
where HibernateUtil is the standard stuff from the manual...so AFAIK the
connection should be open.
I'm using JBoss 4.0.3 sp1, jdk 1.4.2, hibernate 3
Any ideas? Let me know if you need more info...Thanks.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3945383#3945383
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3945383
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user