-
Sep 2nd, 2007, 07:41 AM
#1
Will Spring close the connection for me?
Hi,
I am using a transaction manager and using @Transactional to mark some methods. This is working fine. The connection is closed at the end of the transaction. But what if there is a non-transactional method that creates a connection (using DataSourceUtils.getConnection() or the shared entity manager), will that connection be closed automatically by Spring?
Thanks for any info!
-
Sep 3rd, 2007, 02:06 AM
#2
Spring will only close the connections for you when you call the template methods defined in the data access templates (such as JdbcTemplate, HibernateTemplate, JpaTemplate). If you create the connections by yourself, they won't be closed by Spring. Whether a database connection will be closed automatically should have no relationship with the transactional configuration.
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