[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - valid hibernate session from Dao
jnl
do-not-reply at jboss.com
Mon Nov 19 09:05:34 EST 2007
hi All...
I'm using hibernate 3.2.2ga, jboss 4.0.5.ga, jdk 1.5. I'm trying to run a stored proc (and a query) within my daoImpl class but it's throwing an "unknown connection2" error. The full stack is below. Searching around jboss, I found this site....
http://wiki.jboss.org/wiki/Wiki.jsp?page=IGetquotTryingToReturnAnUnknownConnection2quotError
but it states it's only a hibernate 2 issue. The code is being executed within a callback. I also tried without the callback. My daoImpl extends org.springframework.orm.hibernate3.support.HibernateDaoSupport. below is the code and stack. any help would be appreciated..
thanks in advance..jim
public java.util.Set findVolunteers(final int transform, final java.lang.String queryString, int pageNumber, int pageSize, final java.lang.String firstName, final java.lang.String lastName, final java.lang.String phoneNumber, final java.lang.String status, final java.lang.Boolean requiresFollowUp)
| {
|
| org.springframework.orm.hibernate3.HibernateCallback callback = new org.springframework.orm.hibernate3.HibernateCallback()
| {
| final java.util.Set volunteers = new java.util.HashSet();
| java.sql.PreparedStatement stmt = null;
| java.sql.ResultSet rs = null;
| org.dcri.recruit.VolunteerSearchObject searchObject = null;
|
|
| public Object doInHibernate(org.hibernate.Session session)
| throws org.hibernate.HibernateException
| {
| try {
|
| // Get the connection from hibernate
| Connection conn = session.connection();
| stmt = conn.prepareStatement(query);
|
|
| rs = stmt.executeQuery();
|
| // Process the results
| while (rs.next())
| {
| .....
| }
| }
| catch (Exception e) {
| e.printStackTrace();
| throw new java.lang.RuntimeException("Could not execute Volunteer search", e);
| }
| finally {
| try {
| rs.close();
| session.close();
| }
| catch (Exception e) {
| e.printStackTrace();
| }
| try {
| stmt.close();
| }
| catch (Exception e) {
| e.printStackTrace();
| }
| }
|
| return volunteers;
| }
| };
| return (java.util.Set)this.getHibernateTemplate().execute(callback);
|
and the stack trace...there's more if that'll help...
java.lang.IllegalStateException: Trying to return an unknown connection2! org.jboss.resource.adapter.jdbc.WrappedConnect
| ion at 798797
| at org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedConnectionManager.jav
| a:342)
| at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnect
| ionManager.java:606)
| at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:26
| 6)
| at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:129)
| at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.closeConnection(LocalDataSourceConnectio
| nProvider.java:95)java.lang.IllegalStateException: Trying to return an unknown connection2! org.jboss.resource.adapter.jdbc.WrappedConnect
| ion at 798797
| at org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedConnectionManager.jav
| a:342)
| at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnect
| ionManager.java:606)
| at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:26
| 6)
| at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:129)
| at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.closeConnection(LocalDataSourceConnectio
| nProvider.java:95)
|
|
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106026#4106026
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106026
More information about the jboss-user
mailing list