tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From freeway <...@qad.com>
Subject Re: Transaction Problems with OpenEJB-Hibernate on Tomcat
Date Tue, 16 Feb 2010 04:44:47 GMT

For the record, I resolved this transaction commit-rollback problem using
OpenEJB and Hibernate together, without the need for a custom JTA
transaction factory class (although I wrote one that seemed to work).  All
the EJBs in this application are stateless session beans using
container-managed transactions, so the off-the-shelf Hibernate class
org.hibernate.transaction.CMTTransactionFactory worked fine.

The data source connections are configured in openejb.xml, and the Tomcat
webapp in which the EJBs are deployed has a
WEB-INF/classes/META-INF/persistence.xml file like the following that
references the Hibernate configuration file, where all other
persistence-related settings are stored.

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
             xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="mydb" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>jdbc/MyDS</jta-data-source>
    <non-jta-data-source>jdbc/MyUnmanagedDS</non-jta-data-source>
    <properties>
      <property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>
    </properties>
  </persistence-unit>
</persistence>

Also, some of my entries in the ejb-jar.xml file were wrong or missing,
which was contributing to the problem.

At any rate, if anyone else on this forum is having problems deploying
OpenEJB with Hibernate on Tomcat, please reply and I will pass along any
help that I can.

Regards,
Fred

-- 
View this message in context: http://n4.nabble.com/Transaction-Problems-with-OpenEJB-Hibernate-on-Tomcat-tp1011003p1556932.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Mime
View raw message