|
22 | 22 | import javax.persistence.EntityManager; |
23 | 23 | import javax.persistence.EntityManagerFactory; |
24 | 24 | import javax.persistence.EntityNotFoundException; |
| 25 | +import javax.persistence.LockTimeoutException; |
25 | 26 | import javax.persistence.NoResultException; |
26 | 27 | import javax.persistence.NonUniqueResultException; |
27 | 28 | import javax.persistence.OptimisticLockException; |
28 | 29 | import javax.persistence.PersistenceException; |
| 30 | +import javax.persistence.PessimisticLockException; |
29 | 31 | import javax.persistence.Query; |
| 32 | +import javax.persistence.QueryTimeoutException; |
30 | 33 | import javax.persistence.TransactionRequiredException; |
31 | 34 |
|
32 | 35 | import org.apache.commons.logging.Log; |
|
36 | 39 | import org.springframework.beans.factory.ListableBeanFactory; |
37 | 40 | import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
38 | 41 | import org.springframework.core.Ordered; |
| 42 | +import org.springframework.dao.CannotAcquireLockException; |
39 | 43 | import org.springframework.dao.DataAccessException; |
40 | 44 | import org.springframework.dao.DataAccessResourceFailureException; |
41 | 45 | import org.springframework.dao.DataIntegrityViolationException; |
42 | 46 | import org.springframework.dao.EmptyResultDataAccessException; |
43 | 47 | import org.springframework.dao.IncorrectResultSizeDataAccessException; |
44 | 48 | import org.springframework.dao.InvalidDataAccessApiUsageException; |
| 49 | +import org.springframework.dao.PessimisticLockingFailureException; |
45 | 50 | import org.springframework.jdbc.datasource.DataSourceUtils; |
46 | 51 | import org.springframework.transaction.support.ResourceHolderSynchronization; |
47 | 52 | import org.springframework.transaction.support.TransactionSynchronizationManager; |
@@ -388,6 +393,15 @@ public static DataAccessException convertJpaAccessExceptionIfPossible(RuntimeExc |
388 | 393 | if (ex instanceof NonUniqueResultException) { |
389 | 394 | return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1, ex); |
390 | 395 | } |
| 396 | + if (ex instanceof QueryTimeoutException) { |
| 397 | + return new org.springframework.dao.QueryTimeoutException(ex.getMessage(), ex); |
| 398 | + } |
| 399 | + if (ex instanceof LockTimeoutException) { |
| 400 | + return new CannotAcquireLockException(ex.getMessage(), ex); |
| 401 | + } |
| 402 | + if (ex instanceof PessimisticLockException) { |
| 403 | + return new PessimisticLockingFailureException(ex.getMessage(), ex); |
| 404 | + } |
391 | 405 | if (ex instanceof OptimisticLockException) { |
392 | 406 | return new JpaOptimisticLockingFailureException((OptimisticLockException) ex); |
393 | 407 | } |
|