Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javax.persistence.RollbackException: Transaction marked as rollbackOnly

843830Aug 30 2010
Hi,

I have raw data to be processing.

(1) read each record in the raw data table, and parser them, insert the result into another table, then remove this record from raw data table
(2) if there are exception when insert a bad format, then try to remove this record from raw data table cause the error:
javax.persistence.RollbackException: Transaction marked as rollbackOnly


my code using JPA like this:

while (true) {
RawGpsData raw = findOneGPSLogsRawData();
if(raw != null) {
try{
if(processRawData(raw) {
getEntityManager().getTransaction().begin();
getEntityManager().persist(dataAudiTrail);

getEntityManager().remove(raw);
getEntityManager().getTransaction().commit();
getEntityManager().clear();
}
} catch (RuntimeException re) {
getEntityManager().getTransaction().begin();
getEntityManager().remove(raw);
getEntityManager().getTransaction().commit();
}
}


Can someone help me with this issue?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 27 2010
Added on Aug 30 2010
0 comments
741 views