Announcement Announcement Module
Collapse
No announcement yet.
Is it possible to configure transaction timeouts with Spring 3 and JPA 2.0? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to configure transaction timeouts with Spring 3 and JPA 2.0?

    Hi,

    I'm using Spring 3.1.1.RELEASE, Hibernate 4.1.0.Final, JPA 2.0, and JBoss 7.1.1. I'm building a web application (WAR) and would like to sett an application-wide transaction timeout (without modifying my application server settings). I can't figure out how to configure this or determine if its possible. I've read some posts that suggests it doesn't work for Spring 2.5 and Hibernate 3.

    I'm using the @Service annotation and marking those services as @Transactional.

    Here's how I'm configuring my entity manager in my application context

    Code:
    	<jee:jndi-lookup jndi-name="java:jboss/subco/myprojectpersistence" id="entityManagerFactory"
                         expected-type="javax.persistence.EntityManagerFactory" />
    
    	<bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
       		<property name="entityManagerFactory" ref="entityManagerFactory"/>
    	</bean>
                         
    	<tx:jta-transaction-manager />
    Here's my persistence.xml file

    Code:
    <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="myprojectclientunit">
    		<provider>org.hibernate.ejb.HibernatePersistence</provider>
    		<jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>
    		<properties>
    			<property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml" />
    			<property name="jboss.entity.manager.factory.jndi.name"
    				value="java:jboss/subco/myprojectpersistence" />
    			<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
    		</properties>
    	</persistence-unit>
    </persistence>
    Thanks for any guidance, - Dave
Working...
X