JPA查詢的javadoc(見http://docs.oracle.com/javaee/6/api/javax/persistence/Query.html#executeUpdate())說差異回滾語句,並在JPA交易
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
什麼是回滾statemente和交易之間的區別?我的意思是,回滾事務非常明顯,它會將事務設置爲回滾,並且所有操作都將被撤消。但是,如果語句回滾(因爲它是更新/刪除/插入操作),那麼在這種情況下整個事務是不是也會回滾呢?
這是QueryTimeoutException設計爲被捕獲並允許用戶在超時重試而不影響事務?
不要YOUT仍在尋找答案? –