Hibernate version:
2.1.7c
Mapping documents:
Code:
hibernate.cfg.xml :
...
<property name="connection.provider_class">net.sf.hibernate.connection.C3P0ConnectionProvider</property>
<property name="c3p0.min_size">5</property>
<property name="c3p0.max_size">20</property>
<property name="c3p0.timeout">300</property>
<property name="c3p0.max_statements">50</property>
<property name="c3p0.idle_test_period">3000</property>
...
Code of HibernateUtilCode:
...
public static void rollbackTransaction() {
Transaction tx = (Transaction) threadTransaction.get();
try {
threadTransaction.set(null);
if (tx != null && !tx.wasCommitted() && !tx.wasRolledBack()) {
tx.rollback();
closeSession();
}
} catch (HibernateException ex) {
logger.error("Failed to rollback transaction: " + ex);
}
}
...
public static void closeSession() {
try {
Session s = (Session) threadSession.get();
threadSession.set(null);
if (s != null) {
s.close();
}
} catch (HibernateException ex) {
logger.error("Failed to close Session object: " + ex);
}
}
...
Name and version of the database you are using:MySQL 4.1.7
The generated SQL as seen in the MySQL log:Code:
insert into ....
rollback
rollback
Hi!
When I enable the C3P0 Pool and a transaction rolls back (because of a constraint), the transaction is always rolled back twice. This does not happen if I use the default Hibernate connection pool. It's not a problem so far, but I was wondering why this is happening?
Thanks,
Jonas
[/code]