File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
src/main/java/org/mybatis/spring Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 106
106
<osgi .dynamicImport>*</osgi .dynamicImport>
107
107
108
108
<mybatis .version>3.5.6</mybatis .version>
109
- <spring .version>5.2.9.RELEASE </spring .version>
109
+ <spring .version>5.3.0 </spring .version>
110
110
<spring-batch .version>4.3.0</spring-batch .version>
111
111
<module .name>org.mybatis.spring</module .name>
112
112
Original file line number Diff line number Diff line change 23
23
import org .apache .ibatis .exceptions .PersistenceException ;
24
24
import org .springframework .dao .DataAccessException ;
25
25
import org .springframework .dao .support .PersistenceExceptionTranslator ;
26
+ import org .springframework .jdbc .UncategorizedSQLException ;
26
27
import org .springframework .jdbc .support .SQLErrorCodeSQLExceptionTranslator ;
27
28
import org .springframework .jdbc .support .SQLExceptionTranslator ;
28
29
import org .springframework .transaction .TransactionException ;
@@ -85,7 +86,10 @@ public DataAccessException translateExceptionIfPossible(RuntimeException e) {
85
86
}
86
87
if (e .getCause () instanceof SQLException ) {
87
88
this .initExceptionTranslator ();
88
- return this .exceptionTranslator .translate (e .getMessage () + "\n " , null , (SQLException ) e .getCause ());
89
+ String task = e .getMessage () + "\n " ;
90
+ SQLException se = (SQLException ) e .getCause ();
91
+ DataAccessException dae = this .exceptionTranslator .translate (task , null , se );
92
+ return dae != null ? dae : new UncategorizedSQLException (task , null , se );
89
93
} else if (e .getCause () instanceof TransactionException ) {
90
94
throw (TransactionException ) e .getCause ();
91
95
}
You can’t perform that action at this time.
0 commit comments