I have a web app that is deployed in a load balanced environment on multiple physical instances. All the instances talk to the same database.
I have a transaction that can be triggered from the gui, I want to make sure that if this operation is requested simultaneously, either accross VM's or on the same VM. That only one transaction succeeds or that the transactions are serialized.
I'm using Hibernate 3.6, Spring 3.1 and JPA2 ( jar incl. with Hibernate).
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.SERIALIZABLE, rollbackFor = LockTimeoutException.class)
public boolean MY_OP(Boolean Flag) throws RuntimeException
I'm trying to use the solution described here and here.
My configuration is listed here:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="DB_UNIT_NAME" />
<property name="dataSource" ref="dataSource" />
<property name="jpaDialect">
<bean class="com.server.persistence.HibernateExtendedJpaDialect"/>
</property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="generateDdl" value="true" />
<property name="databasePlatform" value="${dbConfig.dialect}" />
</bean>
</property>
</bean>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
Would this achieve isolation across multiple JVM's in load balanced environments? I'm sure people must have solved this problem before, so any ideas would be helpful.
EDIT
This achieves isolation on a single JVM/AS. I'm using JBoss AS 4.3.2 (yes, I know its old).