Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

For a unit called "movie-unit" using two datasources called "movieDatabase" and "movieDatabaseUnmanaged" the following persistence.xml would work.

Code Block
xmlxml
titlepersistence.xml
xml
<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="movie-unit">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>movieDatabase</jta-data-source>
    <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>

    <properties>
      <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
      <property name="hibernate.transaction.manager_lookup_class"
                value="org.apache.openejb.hibernate.TransactionManagerLookup"/>
    </properties>
  </persistence-unit>
</persistence>

...

Info
titleSome useful FYI from a user

I tried to use openejb 3.0 together with hibernate 3.2.6ga in a maven project. The transitive dependencies of openejb and hibernate collide on asm.jar. A similar problem is described here: http://blog.springsource.com/main/2007/06/11/asm-version-incompatibilities-using-spring-autowired-with-hibernate/Image Removed
or here: http://forum.springframework.org/showthread.php?t=26713&highlight=cglib-nodep+hibernateImage Removedhttp://jira.springframework.org/browse/SPR-3856Image Removed

The solution is to exclude the dependency on asm and cglib on hibernate and to add a dependency on cglib-nodep.