we have 3 data sources(persistence units) in our app. The following exception raised in the senario:
data source 1: create entity 1,
entity2.setEntity1(entity1);
data source 2: create entity 2, entity 1 is a property of entity2
class Entity2 {
Entity1 getEntity1()
void setEntity1(Entity1 entity1)
}
Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2046)
17:45:38,362 ERROR [STDERR] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1964)
17:45:38,363 ERROR [STDERR] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1949)
17:45:38,363 ERROR [STDERR] at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:874)
17:45:38,363 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:365)
17:45:38,363 ERROR [STDERR] at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
17:45:38,363 ERROR [STDERR] at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
Is this a bug? How to work around this?
Thanks,
Dave
Enronment: JBoss 5.0.1.GA.