JPA查询 javadoc (参见 http://docs.oracle.com/javaee/6/api/javax/persistence/Query.html#executeUpdate()) 中提到:
int executeUpdate() Execute an update or delete statement.
Returns: the number of entities updated or deleted
Throws:
IllegalStateException - if called for a Java Persistence query language SELECT statement or for a criteria query
TransactionRequiredException - if there is no transaction
QueryTimeoutException - if the statement execution exceeds
the query timeout value set and only the statement is rolled back
PersistenceException - if the query execution exceeds
the query timeout value set and the transaction is rolled back
回滚语句和事务有什么区别?我的意思是,回滚事务非常明显,它将设置事务为回滚状态,所有操作都将被撤销。但如果语句被回滚(因为它是一个更新/删除/插入操作),那么整个事务在这种情况下也会被回滚吗?
这个QueryTimeoutException是否设计成可以捕获并允许用户在超时时重试而不影响事务?