-->
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.  [ 5 posts ] 
Author Message
 Post subject: Websphere and transactions (closing sessions)
PostPosted: Tue Jan 27, 2004 9:01 am 
Newbie

Joined: Tue Dec 16, 2003 9:57 am
Posts: 13
Hi,
I'm using Hibernate 2.1.1, Windows 2000, Jdk 1.3, WebSphere 4.02 and DB2 7.2. I'm having trouble using a websphere datasource. Here's what I do:

Code:
Session session = null;
try {
  session = SessionFactoryPlant.getSessionFactory().openSession( new RKTInterceptor());
  session.saveOrUpdate(case);   
} catch( HibernateException e ) {
  LOGGER.debug( "An HibernateException occured during saving, thrown as a PersistException", e );
  throw new PersistException( e );
} finally {
  if (session != null && session.isOpen() ) {
    try {
      session.close();
    } catch (HibernateException h) {
      LOGGER.warn("Exception while closing session.", h);
    }
  }
}


This result in the following exception:
Code:
javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 0 No;

nested exception is:
org.omg.CORBA.TRANSACTION_ROLLEDBACK: com.ibm.websphere.csi.CSITransactionRolledbackException:
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:194)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:67)
at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:414)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:1772)


Here's the hibernate.cfg.xml:
Code:
<hibernate-configuration>
    <session-factory>
        <property name="show_sql">true</property>
        <property name="dialect">net.sf.hibernate.dialect.DB2Dialect</property>
        <property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
        <!-- Database properties, in app server environment -->
        <property name="hibernate.connection.datasource">jdbc/rkt</property> 


Any ideas on what I'm doing wrong? All help appreciated!

Regards,
Ola


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 9:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
net.sf.hibernate.transaction.JDBCTransactionFactory is definately wrong for usage in an AppServer. You need to delegate transactions to the underlying JTA api. You need to use JTATransactionFactory, and set transaction manager lookup class. And stuff :) Sorry, have no conrete example here, search your way through the docs and the forum.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 9:14 am 
Newbie

Joined: Tue Dec 16, 2003 9:57 am
Posts: 13
As you can see of my code, I'm not using the transaction API at all, and it still don' work...

- Ola


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 27, 2004 9:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Inside an appserver (suspect this is an EJB) you are allways using transactions (JTA). In any case, you should allways use transactions. And integrate Hibernate the way it is supposed with the AppServer and not in some crude JDBC based transaction way.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 10, 2004 4:44 am 
Beginner
Beginner

Joined: Mon Nov 24, 2003 12:44 pm
Posts: 40
Try using the following settings...

Code:
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.WebSphereTransactionManagerLookup</property>


Cheers
Chris


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