Announcement Announcement Module
Collapse
No announcement yet.
Jpa(Hibernate) JTA Glassfish Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jpa(Hibernate) JTA Glassfish

    Hi,

    I am using Spring 3 – JPA (Hibernate 3.6) – Glassfish 3.1 I am currenty using JpaTransactionManager, I want to change it to JTA. But I couldn’t get it work, i don't get any error but can not update entities in databaseMy configuration files are below. What am I missing?



    <tx:annotation-driven transaction-manager="transactionManager" />

    <jee:jndi-lookup id="jpaDatasource" jndi-name="jdbc/myDs" />

    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
    <property name="persistenceUnitName" value="myPU" />
    <property name="dataSource" ref="jpaDatasource" />
    <property name="jpaDialect">
    <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaDialect" />
    </property>
    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">
    <property name="showSql" value="true" />
    <property name="generateDdl" value="false" />
    <property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
    </bean>
    </property>
    <property name="jpaProperties">
    <props>
    <prop key="hibernate.transaction.factory_class">org.hibe rnate.transaction.JTATransactionFactory
    </prop>
    <prop key="hibernate.transaction.manager_lookup_class">o rg.hibernate.transaction.SunONETransactionManagerL ookup</prop>
    </props>
    </property>

    <bean id="transactionManager"
    class="org.springframework.transaction.jta.JtaTran sactionManager">
    </bean>


    <persistence 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"
    version="1.0">

    <persistence-unit name="myPU" transaction-type="JTA">
    <properties>
    <property name="hibernate.cache.use_second_level_cache"
    value="true" />
    <property name="hibernate.cache.use_query_cache" value="true" />
    <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.EhCacheProvider" />
    <property name="net.sf.ehcache.configurationResourceName"
    value="ehcache.xml" />

    <property name="hibernate.search.default.directory_provider"
    value="org.hibernate.search.store.FSDirectoryProvi der" />
    <property name="javax.persistence.validation.mode" value="none" />
    <property name="hibernate.format_sql" value="true" />
    <property name="hibernate.ejb.event.post-insert"
    value="org.hibernate.ejb.event.EJB3PostInsertEvent Listener,org.hibernate.envers.event.AuditEventList ener" />
    <property name="hibernate.ejb.event.post-update"
    value="org.hibernate.ejb.event.EJB3PostUpdateEvent Listener,org.hibernate.envers.event.AuditEventList ener" />
    <property name="hibernate.ejb.event.post-delete"
    value="org.hibernate.ejb.event.EJB3PostDeleteEvent Listener,org.hibernate.envers.event.AuditEventList ener" />
    <property name="hibernate.ejb.event.pre-collection-update"
    value="org.hibernate.envers.event.AuditEventListen er" />
    <property name="hibernate.ejb.event.pre-collection-remove"
    value="org.hibernate.envers.event.AuditEventListen er" />
    <property name="hibernate.ejb.event.post-collection-recreate"
    value="org.hibernate.envers.event.AuditEventListen er" />
    <property name="org.hibernate.envers.audit_table_suffix"
    value="_R" />
    <property name="org.hibernate.envers.revision_field_name"
    value="ENTITY_REVISION_ID" />
    <property name="org.hibernate.envers.revision_type_field_nam e"
    value="ENTITY_REVISION_TYPE_ID" />
    </properties>
    </persistence-unit>
    </persistence>


    I am using com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
Working...
X