I have a stateless bean method that calls
em.createNativeQuery(sql).executeUpdate();
I call it from another method in the same SLSB in a loop. If, for example the
first call fails, then all subsequent calls fail with this error:
javax.persistence.TransactionRequiredException: Executing an update/delete query
Am I required to do something to "clean-up" the first error? I thought the
REQUIRES_NEW transaction annotation would start over with a clean slate so to
speak.
Please advise.
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public int runStatement(String sql) throws Exception
{
try {
return em.createNativeQuery(sql).executeUpdate();
}
catch (Exception ex)
{
log.error(....);
throw(ex);
}
}
also: The calling method catches the re-thrown exception.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157702#4157702
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157702
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user