Dear All,
When executing the openJPA 2.0,
org.apache.openjpa.persistence.datacache.CacheLoadTest, the tester thread
encounters the following exceptions during insert operations ....
java.sql.SQLIntegrityConstraintViolationException: The statement was aborted
because it would have caused a duplicate key value in a unique or primary
key constraint or unique index identified by 'SQL091019011222610' defined on
'OPENJPA_SEQUENCE_TABLE'.
org.apache.openjpa.util.ObjectExistsException: The statement was aborted
because it would have caused a duplicate key value in a unique or primary
key constraint or unique index identified by 'SQL091019011222610' defined on
'OPENJPA_SEQUENCE_TABLE'.
org.apache.openjpa.persistence.EntityExistsException: The statement was
aborted because it would have caused a duplicate key value in a unique or
primary key constraint or unique index identified by 'SQL091019011222610'
defined on 'OPENJPA_SEQUENCE_TABLE'.
Is there a way to avoid these exceptions during the transaction commit i.e.
can I check for SQLIntegrityConstraint before ending the transaction.
Code for insert:
private void insert()
throws Exception {
EntityManager em = emf.createEntityManager();
startTx(em);
for (int i = 0; i < (rnd(100)); i++) {
em.persist(randomizeBean(rndclass().newInstance()));
}
endTx(em);
endEm(em);
}
--Thanks,
Rohit Kelapure
--
View this message in context:
http://n2.nabble.com/SQLIntegrityConstraintViolationException-when-running-CacheLoadTest-tp3858228p3858228.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.