title: Getting org.apache.openjpa.persistence.OptimisticLockException: Unable to obtain an object lock on "null"
body: <p>I am getting below exception while doing EntityManager.find(). We are using DB2 database and WAS 8.0 server for our application. Any help greatly appreciated. </p>
  
  <pre><code>Caused by: &lt;openjpa-2.1.2-SNAPSHOT-r422266:1709309 nonfatal store error&gt; org.apache.openjpa.persistence.OptimisticLockException: Unable to obtain an object lock on "null".
  at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4930)
  at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4908)
  at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(DB2Dictionary.java:603)
  at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136)
  at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:110)
  at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:62)
  at org.apache.openjpa.jdbc.kernel.PreparedSQLStoreQuery$PreparedSQLExecutor.executeQuery(PreparedSQLStoreQuery.java:139)
  at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1012)
  at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:870)
  at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:801)
  at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
  at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:315)
  at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:331)
  
  ... 116 more
  
  Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: DB2 SQL Error: SQLCODE=-913, SQLSTATE=57033, SQLERRMC=00C90088;00000304;ODNC001 .SNCPC145.X'200D65' '.X'43', DRIVER=4.15.134 {prepstmnt -1803801027 
  SELECT a.column1 
  FROM table_test a 
  WHERE (a.column2 = ? AND a.column3 = ?) 
  [params=(String) 00000, (String) 000011]} [code=-913, state=57033]
  at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:281)
  at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:265)
  at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:72)
  at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1183)
  at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:284)
  at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1787)
  at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:274)
  at org.apache.openjpa.jdbc.kernel.PreparedSQLStoreQuery$PreparedSQLExecutor.executeQuery(PreparedSQLStoreQuery.java:118)
  ... 123 more
  </code></pre>