-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: [Solved] Extended persistence context results in a deadlock
PostPosted: Thu Jun 16, 2011 4:59 am 
Newbie

Joined: Fri Apr 29, 2011 10:29 am
Posts: 5
Hi,

I'm using Hibernate (3.5.6) + Spring (3.0.5) + JSF (2.1.1-b03) to build a web app. MySQL 5.5.10 is the data provider, connected by mysql-connector 5.1.9. c3p0 (0.9.1.2) is the connection pool manager.

I'm facing some row dead lock for a while, but until now I always manage to find a workaround. After many days, I finally discover something, and I would like to get some explanation on it :

- If my persistence context is marked as Transaction, I don't encounter dead lock.
- If I set the persistence context to be Extended (so, shared by the entire application, right ?), I meet my dear friend deadlock!!

I just would like to know how changing the persistence context type can change so many things... I this a question of implementation ? Or can this be caused by my persistence-unit's transaction-type, which is "RESSOURCE_LOCAL" (I'm using Tomcat 7.0.14, so as far as I know, I can't use JTA, right ?)

The dead lock appear in such a situation (cars and wheels have their own tables, and there is a foreign key from wheel to car) :
Code:
Car c = new Car();
[....]
c = this.carService.create(c);

Wheel w = new Wheel();
[.....]
w.setCar(c);
w = this.wheelService.create(w);   //<===== Dead lock appears here


The really strange thing, is that I can the MySQL locking the car's row, but only when wheelService.create(w) is called. It's like Hibernate (or MySQL) is locking itself for nothing!!

All that process is done under an unique transaction (I first wanted to used Nested transaction, but it's not supported)

Thanks,

LTourist


EDIT : See last post for final thoughts about this issue => DO NOT use an extended persistence context outside of a J2E app, what ever you can read that this is a good solution ;)


Last edited by LTourist on Tue Aug 09, 2011 12:48 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Extended persistence context results in a deadlock
PostPosted: Mon Jun 20, 2011 4:47 am 
Newbie

Joined: Fri Apr 29, 2011 10:29 am
Posts: 5
Hi again,

I said before that my problem was a deadlock. It's not actually. It's just a lock timeout generated by the fact that I intend to insert a new line in a table with a foreign key using a record that was just inserted by another transaction (which is not closed yet)

I've made some investigations and did find something : every time a JPA transaction is started, and joined with the current one (which is the expected behavior of the propagation.REQUIRED used in my services' methods), a new connection is taken fromt the pool managed by c3p0. Thus, MySQL start a new transaction.

Should a new transaction be started instead of using the existing one ? If not, this seems to me like XA Transactions are used, or intented to use on the JPA side but that MySQL does not see it in that way.

Here is the log written by my app while generating the lock issue :

Quote:
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Creating new transaction with name [gpaf.services.impl.UserService.find]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Opened new EntityManager [org.hibernate.ejb.EntityManagerImpl@15d4273] for JPA transaction
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@15c6c8d]
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 3, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Starting resource local transaction on application-managed EntityManager [org.hibernate.ejb.EntityManagerImpl@17cff66]
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Joined local transaction
17 juin 2011 05:09:39 [main] org.hibernate.SQL - select user0_.ID as ID3_0_, user0_.droits as droits3_0_, user0_.hibernate_version as hibernate3_3_0_, user0_.login as login3_0_, user0_.password as password3_0_ from user user0_ where user0_.ID=?
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( com.mysql.jdbc.JDBC4Connection@1195c2b ).size(): 1
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 1; num connections: 1; num keys: 1
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Initiating transaction commit
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Committing JPA transaction on EntityManager [org.hibernate.ejb.EntityManagerImpl@15d4273]
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 3, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Closing JPA EntityManager [org.hibernate.ejb.EntityManagerImpl@15d4273] after transaction
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.EntityManagerFactoryUtils - Closing JPA EntityManager
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Creating new transaction with name [gpaf.services.impl.VersionApplicativeService.findLastVaVersionNumber]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Opened new EntityManager [org.hibernate.ejb.EntityManagerImpl@c360a5] for JPA transaction
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@145c761]
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@c360a5] for JPA transaction
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Participating in existing transaction
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 3, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Starting resource local transaction on application-managed EntityManager [org.hibernate.ejb.EntityManagerImpl@24c672]
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Joined local transaction
17 juin 2011 05:09:39 [main] org.hibernate.SQL - select max(this_.VERSION) as y0_ from version_applicative this_
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( com.mysql.jdbc.JDBC4Connection@dc1f04 ).size(): 1
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 1; num connections: 2; num keys: 2
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Initiating transaction commit
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Committing JPA transaction on EntityManager [org.hibernate.ejb.EntityManagerImpl@c360a5]
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 3, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 2; num keys: 2
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Closing JPA EntityManager [org.hibernate.ejb.EntityManagerImpl@c360a5] after transaction
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.EntityManagerFactoryUtils - Closing JPA EntityManager
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - No local transaction to join
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [main] org.hibernate.SQL - select abaque0_.ID as ID0_0_, abaque0_.DATE_DEB as DATE2_0_0_, abaque0_.DATE_FIN as DATE3_0_0_, abaque0_.hibernate_version as hibernate4_0_0_, abaque0_.NOM as NOM0_0_ from abaque abaque0_ where abaque0_.ID=?
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( com.mysql.jdbc.JDBC4Connection@dc1f04 ).size(): 2
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 3; checked out: 1; num connections: 2; num keys: 3
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 3; checked out: 0; num connections: 2; num keys: 3
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 3; checked out: 0; num connections: 2; num keys: 3
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 3; checked out: 0; num connections: 2; num keys: 3
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Creating new transaction with name [gpaf.services.impl.VersionApplicativeService.createVa]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Opened new EntityManager [org.hibernate.ejb.EntityManagerImpl@a37c6a] for JPA transaction
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 4, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@7881db]
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@a37c6a] for JPA transaction
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Participating in existing transaction
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 3, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Starting resource local transaction on application-managed EntityManager [org.hibernate.ejb.EntityManagerImpl@24c672]
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Joined local transaction
17 juin 2011 05:09:39 [main] org.hibernate.SQL - select max(this_.VERSION) as y0_ from version_applicative this_
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( com.mysql.jdbc.JDBC4Connection@1195c2b ).size(): 2
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 4; checked out: 1; num connections: 2; num keys: 4
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 4; checked out: 0; num connections: 2; num keys: 4
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Joined local transaction
17 juin 2011 05:09:39 [main] org.hibernate.SQL - select this_.ID as ID9_0_, this_.ID_ABAQUE as ID9_9_0_, this_.ANNEE as ANNEE9_0_, this_.DATE_MEP as DATE3_9_0_, this_.DATE_MES as DATE4_9_0_, this_.hibernate_version as hibernate5_9_0_, this_.PALIER as PALIER9_0_, this_.STATUT_VERSION as STATUT7_9_0_, this_.VERSION as VERSION9_0_ from version_applicative this_ where this_.VERSION=?
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( com.mysql.jdbc.JDBC4Connection@1195c2b ).size(): 3
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 5; checked out: 1; num connections: 2; num keys: 5
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 5; checked out: 0; num connections: 2; num keys: 5
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Joined local transaction
17 juin 2011 05:09:39 [main] org.hibernate.SQL - insert into version_applicative (ID_ABAQUE, ANNEE, DATE_MEP, DATE_MES, hibernate_version, PALIER, STATUT_VERSION, VERSION) values (?, ?, ?, ?, ?, ?, ?, ?)
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( com.mysql.jdbc.JDBC4Connection@1195c2b ).size(): 4
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 6; checked out: 1; num connections: 2; num keys: 6
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 6; checked out: 0; num connections: 2; num keys: 6
17 juin 2011 05:09:39 [main] org.hibernate.SQL - select processusa0_.ID_VERSION_APPLICATIVE as ID7_9_1_, processusa0_.ID as ID1_, processusa0_.ID as ID8_0_, processusa0_.DESCR as DESCR8_0_, processusa0_.DESC_SFG as DESC3_8_0_, processusa0_.hibernate_version as hibernate4_8_0_, processusa0_.NOM as NOM8_0_, processusa0_.REF_SFG as REF6_8_0_, processusa0_.ID_VERSION_APPLICATIVE as ID7_8_0_ from processus_applicatif processusa0_ where processusa0_.ID_VERSION_APPLICATIVE=?
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( com.mysql.jdbc.JDBC4Connection@1195c2b ).size(): 5
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 7; checked out: 1; num connections: 2; num keys: 7
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 7; checked out: 0; num connections: 2; num keys: 7
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@a37c6a] for JPA transaction
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.JpaTransactionManager - Participating in existing transaction
17 juin 2011 05:09:39 [main] com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@5d855f [managed: 5, unused: 2, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@1758cd1)
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Starting resource local transaction on application-managed EntityManager [org.hibernate.ejb.EntityManagerImpl@65394b]
17 juin 2011 05:09:39 [main] org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler - Joined local transaction
17 juin 2011 05:09:39 [main] org.hibernate.SQL - insert into processus_applicatif (DESCR, DESC_SFG, hibernate_version, NOM, REF_SFG, ID_VERSION_APPLICATIVE) values (?, ?, ?, ?, ?, ?)
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - cxnStmtMgr.statementSet( com.mysql.jdbc.JDBC4Connection@6d999a ).size(): 1
17 juin 2011 05:09:39 [main] com.mchange.v2.c3p0.stmt.GooGooStatementCache - checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 8; checked out: 1; num connections: 3; num keys: 8
17 juin 2011 05:10:30 [main] com.mchange.v2.c3p0.impl.NewPooledConnection - com.mchange.v2.c3p0.impl.NewPooledConnection@14b9a74 handling a throwable.
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction


Anyone ?

Thanks


Top
 Profile  
 
 Post subject: Re: Extended persistence context results in a deadlock
PostPosted: Tue Jun 21, 2011 10:56 am 
Newbie

Joined: Fri Apr 29, 2011 10:29 am
Posts: 5
Using oracle did solve the issue...

MySQL definitly have some lack on transaction management :/


Top
 Profile  
 
 Post subject: Re: [Solved] Extended persistence context results in a deadlock
PostPosted: Tue Aug 09, 2011 12:46 pm 
Newbie

Joined: Fri Apr 29, 2011 10:29 am
Posts: 5
After some weeks, I finally discovered that MySQL can not be charged of bad transaction management. The mistake I did was using an Extended Persistence Context outside of a J2E application (Tomcat) with Spring as a dependency injecter.

Why ? See here.

In a nuthell : in this configuration, Spring inject an Entity Manager per DAO. As a result, those managers don't share the same level 1 cache, and some entities you created in a DAO can not be seen in another. Of course, it can work, because if you session is flushed in the first DAO before you call the second one, then the level 2 cache is updated (shared by all entity managers).

Hope this will help someone someday ! ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.