openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajiyos Yohannan <aji...@gmail.com>
Subject Intermittent OptimisticException with Persist on many to many self referencing entities.
Date Thu, 19 Nov 2009 13:39:36 GMT
I have a self referencing table "PR_PARTNER" with ManyToMany relationship
using a join table PR_CATLINK

*

public class _Partner implements Serializable {

.....

@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="partnerSeqGen")
private int partnerId;

@Version

private int rowts;

@ManyToMany
@JoinTable(name = "PR_PRCAT_LNK", joinColumns = @JoinColumn(name =
"PARTNERID"), inverseJoinColumns = @JoinColumn(name = "CATEGORYID",
referencedColumnName = "PARTNERID"))
private Set<_Partner> categories = new HashSet<_Partner>();

@ManyToMany(mappedBy = "categories")
private Set<_Partner> members = new HashSet<_Partner>();
}*
I am using openjpa as standalone mode(not container managed) from servlet
container.

I am invoking a servlet which persist the category with multiple members.
On third/fourth invocation I am getting OptimisticException.
I am not sharing the entitymanager
I havent enabled the data cache
*Observation* is that for the failing invocation, the version field is not
updated for the children entities in the cache though the version is changed
in the db.
Logs:
I

[11/18/09 11:51:16:671 GMT+05:30] 00000049 SystemErr     R 62304453
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> executing prepstmnt 820523240 INSERT INTO PR_PARTNER
(partnerId, categoryFlag, createdate, description, DISPLAYNAME, NAME,
statusFlg, updatedate, website, rowts, COMMUNITYID, PARENTPARTNERID,
PARTNERTYPEID, VENDORTYPENAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?) [params=(int) 35, (int) 1, (Timestamp) 2009-11-18 11:51:16.218,
(String) szjdfsd, (null) null, (String) today, (int) 0, (Timestamp)
2009-11-18 11:51:16.218, (null) null, (int) 1, (int) 1, (null) null, (int)
2, (null) null]
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [16 ms] spent
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> batching prepstmnt 1573674444 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 13, (int) 6, (int) 12]
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [0 ms] spent
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> batching prepstmnt 1573674444 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 9, (int) 8, (int) 8]
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [0 ms] spent
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> batching prepstmnt 1573674444 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 16, (int) 3, (int) 15]
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [0 ms] spent
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> executing batch prepstmnt 1573674444 UPDATE PR_PARTNER SET
rowts = ? WHERE partnerId = ? AND rowts = ? [params=(int) 16, (int) 3, (int)
15]
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [0 ms] spent
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> batching prepstmnt 1636655501 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 6, (int) 35]
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [0 ms] spent
[11/18/09 11:51:16:687 GMT+05:30] 00000049 SystemErr     R 62304469
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> batching prepstmnt 1636655501 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 8, (int) 35]
[11/18/09 11:51:16:703 GMT+05:30] 00000049 SystemErr     R 62304485
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [0 ms] spent
[11/18/09 11:51:16:703 GMT+05:30] 00000049 SystemErr     R 62304485
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> batching prepstmnt 1636655501 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 3, (int) 35]
[11/18/09 11:51:16:703 GMT+05:30] 00000049 SystemErr     R 62304485
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [0 ms] spent
[11/18/09 11:51:16:703 GMT+05:30] 00000049 SystemErr     R 62304485
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> executing batch prepstmnt 1636655501 INSERT INTO
PR_PRCAT_LNK (PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 3, (int)
35]
[11/18/09 11:51:16:703 GMT+05:30] 00000049 SystemErr     R 62304485
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1849912899> [0 ms] spent
[11/18/09 11:51:16:703 GMT+05:30] 00000049 SystemErr     R 62304485
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.JDBC - <t
1346457665, conn 1849912899> [0 ms] commit
[11/18/09 11:51:16:703 GMT+05:30] 00000049 SystemErr     R 62304485
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.JDBC - <t
1346457665, conn 1849912899> [0 ms] close

03578  DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t
267849719, conn 1874489274> executing prepstmnt 569385456 INSERT INTO
PR_PARTNER (partnerId, categoryFlag, createdate, description, DISPLAYNAME,
NAME, statusFlg, updatedate, website, rowts, COMMUNITYID, PARENTPARTNERID,
PARTNERTYPEID, VENDORTYPENAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?) [params=(int) 36, (int) 1, (Timestamp) 2009-11-18 11:57:55.406,
(String) SDF, (null) null, (String) TodAY1, (int) 0, (Timestamp) 2009-11-18
11:57:55.406, (null) null, (int) 1, (int) 1, (null) null, (int) 2, (null)
null]
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [0 ms] spent
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> batching prepstmnt 1833266501 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 2, (int) 4, (int) 1]
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [0 ms] spent
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> batching prepstmnt 1833266501 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 14, (int) 6, (int) 13]
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [0 ms] spent
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> batching prepstmnt 1833266501 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 10, (int) 8, (int) 9]
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [0 ms] spent
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> executing batch prepstmnt 1833266501 UPDATE PR_PARTNER SET
rowts = ? WHERE partnerId = ? AND rowts = ? [params=(int) 10, (int) 8, (int)
9]
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [0 ms] spent
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> batching prepstmnt 1238911448 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 4, (int) 36]
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [0 ms] spent
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> batching prepstmnt 1238911448 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 6, (int) 36]
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [0 ms] spent
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> batching prepstmnt 1238911448 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 8, (int) 36]
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [0 ms] spent
[11/18/09 11:57:55:796 GMT+05:30] 00000045 SystemErr     R 62703578
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> executing batch prepstmnt 1238911448 INSERT INTO
PR_PRCAT_LNK (PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 8, (int)
36]
[11/18/09 11:57:55:812 GMT+05:30] 00000045 SystemErr     R 62703594
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.SQL - <t 267849719,
conn 1874489274> [16 ms] spent
[11/18/09 11:57:55:812 GMT+05:30] 00000045 SystemErr     R 62703594
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.JDBC - <t 267849719,
conn 1874489274> [0 ms] commit
[11/18/09 11:57:55:812 GMT+05:30] 00000045 SystemErr     R 62703594
DataAccessLayer  TRACE  [WebContainer : 1] openjpa.jdbc.JDBC - <t 267849719,
conn 1874489274> [0 ms] close

......


[11/18/09 12:06:07:578 GMT+05:30] 00000049 SystemErr     R 63195360
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> executing prepstmnt 226364798 INSERT INTO PR_PARTNER
(partnerId, categoryFlag, createdate, description, DISPLAYNAME, NAME,
statusFlg, updatedate, website, rowts, COMMUNITYID, PARENTPARTNERID,
PARTNERTYPEID, VENDORTYPENAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?) [params=(int) 37, (int) 1, (Timestamp) 2009-11-18 12:06:07.187,
(String) skfdsdf, (null) null, (String) today3, (int) 0, (Timestamp)
2009-11-18 12:06:07.187, (null) null, (int) 1, (int) 1, (null) null, (int)
2, (null) null]
[11/18/09 12:06:07:578 GMT+05:30] 00000049 SystemErr     R 63195360
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [0 ms] spent
[11/18/09 12:06:07:578 GMT+05:30] 00000049 SystemErr     R 63195360
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> batching prepstmnt 1446794812 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 14, (int) 6, (int) 13]
[11/18/09 12:06:07:593 GMT+05:30] 00000049 SystemErr     R 63195375
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [15 ms] spent
[11/18/09 12:06:07:593 GMT+05:30] 00000049 SystemErr     R 63195375
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> batching prepstmnt 1446794812 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 10, (int) 8, (int) 9]
[11/18/09 12:06:07:593 GMT+05:30] 00000049 SystemErr     R 63195375
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [0 ms] spent
[11/18/09 12:06:07:593 GMT+05:30] 00000049 SystemErr     R 63195375
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> batching prepstmnt 1446794812 UPDATE PR_PARTNER SET rowts =
? WHERE partnerId = ? AND rowts = ? [params=(int) 17, (int) 3, (int) 16]
[11/18/09 12:06:07:593 GMT+05:30] 00000049 SystemErr     R 63195375
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [0 ms] spent
[11/18/09 12:06:07:593 GMT+05:30] 00000049 SystemErr     R 63195375
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> executing batch prepstmnt 1446794812 UPDATE PR_PARTNER SET
rowts = ? WHERE partnerId = ? AND rowts = ? [params=(int) 17, (int) 3, (int)
16]
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [32 ms] spent
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> batching prepstmnt 1434604930 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 6, (int) 37]
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [0 ms] spent
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> batching prepstmnt 1434604930 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 8, (int) 37]
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [0 ms] spent
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> batching prepstmnt 1434604930 INSERT INTO PR_PRCAT_LNK
(PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 3, (int) 37]
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [0 ms] spent
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> executing batch prepstmnt 1434604930 INSERT INTO
PR_PRCAT_LNK (PARTNERID, CATEGORYID) VALUES (?, ?) [params=(int) 3, (int)
37]
[11/18/09 12:06:07:625 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.jdbc.SQL - <t 1346457665,
conn 1661494024> [0 ms] spent
[11/18/09 12:06:07:640 GMT+05:30] 00000049 SystemErr     R 63195407
DataAccessLayer  TRACE  [WebContainer : 7] openjpa.Runtime - An exception
occurred while ending the transaction.  This exception will be re-thrown.
<openjpa-1.2.2-SNAPSHOT-r422266:778978M-OPENJPA-975 nonfatal store error>
org.apache.openjpa.util.OptimisticException: Optimistic locking errors were
detected when flushing to the data store.  The following objects may have
been concurrently modified in another transaction:
[com.ibm.bcgex.core.dal.model._Partner-6,
com.ibm.bcgex.core.dal.model._Partner-8]
 at
org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2160)
 at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
 at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908)
 at
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826)
 at
org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
 at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1350)
 at
org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:877)
 at
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:512)



Please help.


Thanks,
Ajiyos

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message