0 Replies Latest reply on Mar 3, 2012 11:09 AM by membersound

    Change persistence from internal ExampleDS to Hibernate resource local?

    membersound

      Hi,

       

      could someone help me porting my already running webapp (AS7 with initial ExampleDS database, Hibernate4) to an existing Hibernate resouce local?

      As far as I read, I cannot use the same config because Jboss AS does not support the resource-local transactiontype.

      What do I actually have to change between the following to configs?

       

      tyvm for you help!

       

       

      actual one:

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence
          version="2.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_2_0.xsd">
          <persistence-unit name="primary">
              <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
              <properties>
      
                  <property name="hibernate.hbm2ddl.auto" value="create-drop" />        
                  <property name="hibernate.show_sql" value="false" />
                  <property
                      name="hibernate.transaction.manager_lookup_class"
                      value="org.hibernate.transaction.JBossTransactionManagerLookup" />
              </properties>
          </persistence-unit>
      </persistence>
      

       

       

      local one:

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="2.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_2_0.xsd">
          <persistence-unit name="primary"
              transaction-type="RESOURCE_LOCAL">
              <provider>org.hibernate.ejb.HibernatePersistence</provider>
      
              <properties>
                  <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />        
                  <property name="hibernate.connection.url" value="jdbc:hsqldb:MyDB;hsqldb.lock_file=false"/>    
                  <property name="hibernate.connection.username" value="user" />
                  <property name="hibernate.connection.password" value="pass" />
                  <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
          
                  <property name="hibernate.hbm2ddl.auto" value="create" />
                  <property name="hibernate.show_sql" value="false" />
              </properties>
          </persistence-unit>
      </persistence>