|
17 | 17 |
|
18 | 18 | import java.sql.SQLException; |
19 | 19 |
|
20 | | -import org.seasar.doma.jdbc.*; |
21 | | -import org.springframework.dao.*; |
| 20 | +import org.seasar.doma.jdbc.JdbcException; |
| 21 | +import org.seasar.doma.jdbc.NoResultException; |
| 22 | +import org.seasar.doma.jdbc.NonSingleColumnException; |
| 23 | +import org.seasar.doma.jdbc.NonUniqueResultException; |
| 24 | +import org.seasar.doma.jdbc.OptimisticLockException; |
| 25 | +import org.seasar.doma.jdbc.ResultMappingException; |
| 26 | +import org.seasar.doma.jdbc.SqlExecutionException; |
| 27 | +import org.seasar.doma.jdbc.UniqueConstraintException; |
| 28 | +import org.seasar.doma.jdbc.UnknownColumnException; |
| 29 | +import org.springframework.dao.DataAccessException; |
| 30 | +import org.springframework.dao.DuplicateKeyException; |
| 31 | +import org.springframework.dao.EmptyResultDataAccessException; |
| 32 | +import org.springframework.dao.IncorrectResultSizeDataAccessException; |
| 33 | +import org.springframework.dao.OptimisticLockingFailureException; |
| 34 | +import org.springframework.dao.TypeMismatchDataAccessException; |
| 35 | +import org.springframework.dao.UncategorizedDataAccessException; |
22 | 36 | import org.springframework.dao.support.PersistenceExceptionTranslator; |
| 37 | +import org.springframework.jdbc.UncategorizedSQLException; |
23 | 38 | import org.springframework.jdbc.support.SQLExceptionTranslator; |
24 | 39 |
|
25 | 40 | /** |
@@ -63,7 +78,8 @@ public DataAccessException translateExceptionIfPossible(RuntimeException ex) { |
63 | 78 | if (ex instanceof SqlExecutionException) { |
64 | 79 | sql = ((SqlExecutionException) ex).getRawSql(); |
65 | 80 | } |
66 | | - return translator.translate(ex.getMessage(), sql, e); |
| 81 | + DataAccessException dae = translator.translate(ex.getMessage(), sql, e); |
| 82 | + return (dae != null ? dae : new UncategorizedSQLException("", sql, e)); |
67 | 83 | } |
68 | 84 |
|
69 | 85 | return new UncategorizedDataAccessException(ex.getMessage(), ex) { |
|
0 commit comments