An application that uses container-managed transaction demarcation creates a query within an active transaction and receives a QueryTimeoutException.
Which of those scenarios describes what happens to the active transaction?
A.
The statement and the transaction continue.
B.
The query is recreated within the current transaction.
C.
The statement and the transaction are marked for rollback.
D.
The statement is rolled back, but the transaction continues.
Explanation:
http://www.google.com.pk/url?sa=t&rct=j&q=application+that+uses+container+managed+transaction+demarcation+creates+a+query+within+an+active+transaction+and+receives+a+QueryTimeoutException+active+transaction+&source=web&cd=10&ved=0CFwQFjAJ&url=http%3A%2F%2Fjgk-spring-recipes.googlecode.com%2Ffiles%2Fpersistence-2_0-final-spec.pdf&ei=gEc6T4iHHe-N4gS0p-WFCw&usg=AFQjCNHs2d7VPsYMyP7qpC4Z11Piigt2UQ
(page 128, summary of exceptions)
D
D is correct http://docs.jboss.org/hibernate/jpa/2.1/api/javax/persistence/QueryTimeoutException.html
D
D
http://www.eclipse.org/eclipselink/api/2.6/index.html?javax/persistence/QueryTimeoutException.html
Correct answer is D.
Remember that all the exceptions defined in javax.persistence extend from javax.persistence.PersistenceException, which in turn extends from java.lang.RuntimeException.
Further, all instances of PersistenceException except for instances of NoResultException, NonUniqueResultException, LockTimeoutException, and QueryTimeoutException will cause the current transaction, if one is active, to be marked for rollback.
This means the transaction will be marked for roll back if the persistence provider throws :- EntityExistsException, EntityNotFoundException, OptimisticLockException, PessimisticLockException.