I am using hibernates implementation of JPA 1, using a Version column for optimistic locking.
When reading and updating the same row from a GUI I successfully receive an optimistic locking exception. When I run concurrent threads through a webservice for the same rows I get the stack trace below..
Code:
Caused by: java.sql.SQLException: [SQL0913] Row or object [TABLE NAME] in [DB SCHEMA] type *FILE in use.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:645)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:616)
at com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:915)
at com.ibm.as400.access.AS400JDBCPreparedStatement.executeQuery(AS400JDBCPreparedStatement.java:1154)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteQuery(WSJdbcPreparedStatement.java:1031)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java:681)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
... 75 more
Surely if I am using optimistic locking the row should not be in use? Am I missing a setting that tells the DB not to lock the rows?
Hibernate 3.3.1
JPA 1
AS400 iSeries
I am using an isolation level of READ_COMMITTED, hibernate.connection.isolation = 2, can this be related? I would have thought the second thread would wait for the first thread to commit rather than return the above error.
Any guidance would be gladly received.
Regards,