-->
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: JTA Transactions. Problem when closing the session.
PostPosted: Tue Dec 02, 2003 12:03 pm 
Newbie

Joined: Tue Dec 02, 2003 11:52 am
Posts: 1
Location: Salzburg
Hi all,
I have jus tried to create my first Hibernate example (simple servlet) using JTA and I cannot get it work..

My question is simply: Do I need to to begin and commit the hibernate Transactions when using JTATransactionFactory?

The problem is that, when using the idiom:

Code:
Session session = factory.openSession();
Transaction tx = null;
try {
    tx = session.beginTransaction();
    // do some work
    ...
    tx.commit();
}
catch (Exception e) {
    if (tx!=null) tx.rollback();
    throw e;
}
finally {
    session.close();
}


I always get this annoying exception in the session.close():

Code:
2003-12-02 15:32:43,937 [DEBUG] impl.SessionImpl closing session
2003-12-02 15:32:43,937 [DEBUG] impl.SessionImpl disconnecting session
2003-12-02 15:32:43,937 [ERROR] util.JDBCExceptionReporter Cannot close connection
java.sql.SQLException: The transaction is no longer active - status: 'Committed'. No further JDBC access is allowed within this transaction.
   at weblogic.jdbc.wrapper.JTSConnection.checkIfRolledBack(JTSConnection.java:116)
   at weblogic.jdbc.wrapper.JTSConnection.checkConnection(JTSConnection.java:125)
   at weblogic.jdbc.wrapper.Connection.preInvocationHandler(Connection.java:67)
   at weblogic.jdbc.wrapper.JTSConnection_oracle_jdbc_driver_OracleConnection.getWarnings(Unknown Source)
   at net.sf.hibernate.impl.SessionFactoryImpl.closeConnection(SessionFactoryImpl.java:404)
   at net.sf.hibernate.impl.SessionImpl.disconnect(SessionImpl.java:2946)
   at net.sf.hibernate.impl.SessionImpl.close(SessionImpl.java:438)
   at com.sonynetservices.hibernate.manager.HibernateManager.closeSession(HibernateManager.java:105)


It seems that session.close() tries to commit the transaction again.. Is this normal? Do I need to configure anything in the application server?

I'm using hibernate 2.0.3 in Weblogic 8.1 with an Oracle8 DB, my entries in hibernate config.xml related to transactions look like:

Code:
        <!-- db -->
        <property name="connection.datasource">hibernateDataSource</property>
        <property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
        <!-- transactions -->
        <property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
        <property name="hibernate.transaction.manager_lookup_class">net.sf.hibernate.transaction.WeblogicTransactionManagerLookup</property>


NOTE: Using JDBCTransactionManager works pretty well..

thanks in advance,
Ruben


[quote][/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 3:04 pm 
Newbie

Joined: Wed Sep 10, 2003 3:21 pm
Posts: 18
Location: USA
Are you using hibernate in JTA transaction context ?
Then you don't need to execute start, commit, rollback transaction weblogic transaction manager will do it.


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.