0 Replies Latest reply on Jun 24, 2008 9:24 PM by 666705

    OpenJPA issue with deleting a record with timestamps

    666705
      Hello,

      We have an issue with OpenJPA framework. We are using Oracle 10.2 database with OpenJPA 1.0. We have a database table with a composite primary key. One of the keys is a timestamp. We have a requirement to delete rows from this table. When we do a remove() on this table, we encounter an error like " Caused by: <1.0.0-SNAPSHOT-SNAPSHOT nonfatal user error> org.apache.openjpa.util.InvalidStateException: Operation attempted on a deleted instance.
      at org.apache.openjpa.kernel.PCState.error(PCState.java:443)
      at org.apache.openjpa.kernel.PDeletedState.beforeOptimisticWrite(PDeletedState.java:76)
      at org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1445)
      at org.apache.openjpa.kernel.StateManagerImpl.dirty(StateManagerImpl.java:1384)
      at org.apache.openjpa.util.Proxies.dirty(Proxies.java:68)
      at org.apache.openjpa.util.java$sql$Timestamp$proxy.setNanos(Unknown Source)
      at org.apache.openjpa.jdbc.sql.DBDictionary.setTimestamp(DBDictionary.java:1054)
      at org.apache.openjpa.jdbc.sql.DBDictionary.setTyped(DBDictionary.java:1194)
      at org.apache.openjpa.jdbc.sql.RowImpl.flush(RowImpl.java:883)
      at org.apache.openjpa.jdbc.sql.RowImpl.flush(RowImpl.java:843)
      at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:93)
      at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:71)
      at org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager.flushPrimaryRow(OperationOrderUpdateManager.java:162)
      at org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager.flush(OperationOrderUpdateManager.java:89)
      at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:89)
      at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:514)
      at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130) "

      Record exists in the database but the above error is thrown by JPA. Not sure why JPA is not able to delete a record. Is it because of the timestamp? What we identified while debugging is that the timestamp is stored as 5/29/2008 12:00:00.000000 AM. When we retrieve the value, we get 5/29/2008 00:00:00.0. What we also identified through database trace is that OpenJPA is not hitting database at the delete statement. It executes select, insert and update but we cannot see delete error traces in the database. Could you help identify where the issue is?

      Thanks,
      Padma.