-
Aug 17th, 2009, 10:36 AM
#1
Debugging hangs
Hi,
I'm having difficulty with debugging an integration test.
Problem description:
I'm having a table lock when I'm debugging with a junit integration test. The reason I'm getting a table lock is when a session is not closed when a exception occurs during debugging.
I have 3 to 4 runs to get my code right. If after 4 runs my code is not correct debugging hangs. My guess is that the session is not correctly closed.
I know the session must be closed automatically but it doesn't happen because I have asked a couple of times to kill my session.
Is there a way to configuratie hibernate to close the session?
The entitymanagerfactory bean:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
<!-- reference to the XA datasource -->
<property name="dataSource" ref="bdbDataSource" />
<property name="persistenceUnitName" value="TAXI" />
<!-- specify Hibernate as the the JPA provider -->
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">
<property name="showSql" value="false" />
<property name="generateDdl" value="false" />
<property name="database" value="ORACLE" />
<property name="databasePlatform" value="org.hibernate.dialect.Oracle10gDialect" />
</bean>
</property>
<!--
configure Hibernate to participate in JTA transactions using the JOTM
transaction manager and specify further Hibernate specific
configuration properties
-->
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JOTMTransactionMa nagerLookup" />
<entry key="hibernate.transaction.flush_before_completion "
value="true" />
<entry key="hibernate.transaction.auto_close_session" value="false" />
<entry key="hibernate.current_session_context_class" value="jta" />
<entry key="hibernate.connection.release_mode" value="auto" />
<!--
TEMP SOLUTION Comment out the following two tags if you are testing
in OC4J <entry key="hibernate.hbm2ddl.auto" value="create-drop" />
<entry key="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect" />
-->
<!--
TEMP SOLUTION Comment out the above two tags if you are testing in
OC4J
-->
</map>
</property>
<!--
specify that the Hibernate JPA dialect should be used, probably not
necessary since HibernateJpaVendorAdapter will most likely set this
property
-->
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaDialect" />
</property>
<!--
custom implementation to enrich the PersistenceUnitInfo read from the
persistence.xml JPA configuration file with the JTA datasource.
specifying the JTA datasource directly in the Spring configuration
file has the advantage that we can use a direct reference to the
datasource instead of using a JNDI name as requied by the
jta-data-source setting in the persistence.xml file
-->
<property name="persistenceUnitPostProcessors">
<bean
class="nl.wsh.taxi.odb.persistence.util.jta.JtaPer sistenceUnitPostProcessor">
<property name="jtaDataSource" ref="bdbDataSource" />
</bean>
</property>
</bean>
The transactionmanager
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTran sactionManager">
<property name="userTransaction" ref="jotm" />
<property name="allowCustomIsolationLevels" value="true" />
</bean>
Any suggestions would be appreciated.
Kind regards,
Josip
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules