We have a spring application deployed on jboss 7 server.
The application uses several data sources obtained from jboss through jndi.
Transaction management is also provided by the Java EE container (we use spring JtaTransactionManager)
The application architecture is deprecated with a DAO extending sleep patterns (using spring HibernateDaoSupport).
A transaction is managed at the service level using annotations @Transactional.
My first questions are:
when the annotation occurs, how does the transaction manager know which data sources will be involved in the transaction?
when does it efficiently retrieve a JDBC connection and to which data sources? when does it effectively open a transaction? (only DAOs got a link to sessionFactory bound to a specific data source).
The driver that we use does not support distributed transactions (XA) , in most cases we do not need multiphase commit, since only one data source is written. In any case, when we access (read-only) other data sources in a single transaction, we received messages in the logs:
INFO [org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager] (http--0.0.0.0-8080-4) IJ000100: Closing a connection for you. Please close them yourself: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6@691644c: java.lang.Throwable: STACKTRACE
at org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManagerImpl.registerConnection(CachedConnectionManagerImpl.java:265)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:495)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) [hibernate-core-3.3.1.GA.jar:3.3.1.GA]
[...]
Is there a way to properly manage the release of a connection in this case without using XA data sources?
Otherwise, can these messages be ignored or do they indicate a real problem? (journal level - INFO)
[edit]
Some additional configuration data:
<bean id="customersDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/${shared.datasource}" />
</bean>
sessionFactory
<bean id="sharedSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="customersDataSource" />
<property name="configLocation" value="classpath:hibernate.shared.cfg.xml" />
<property name="hibernateProperties">
<props>
<prop key="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
<prop key="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</prop>
<prop key="hibernate.connection.release_mode">after_transaction</prop>
<prop key="hibernate.transaction.auto_close_session">true</prop>
[...]
</props>
</property>
</bean>
, hibernate.connection.release_mode, , .