commit
						e8ddb93d7b
					
				| 
						 | 
					@ -26,8 +26,8 @@ import org.jooq.SQLDialect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.dao.DataAccessException;
 | 
					import org.springframework.dao.DataAccessException;
 | 
				
			||||||
import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator;
 | 
					import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator;
 | 
				
			||||||
 | 
					import org.springframework.jdbc.support.SQLExceptionSubclassTranslator;
 | 
				
			||||||
import org.springframework.jdbc.support.SQLExceptionTranslator;
 | 
					import org.springframework.jdbc.support.SQLExceptionTranslator;
 | 
				
			||||||
import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
 | 
					 | 
				
			||||||
import org.springframework.util.Assert;
 | 
					import org.springframework.util.Assert;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -114,7 +114,7 @@ final class DefaultExceptionTranslatorExecuteListener implements ExceptionTransl
 | 
				
			||||||
		private SQLExceptionTranslator apply(SQLDialect dialect) {
 | 
							private SQLExceptionTranslator apply(SQLDialect dialect) {
 | 
				
			||||||
			String dbName = getSpringDbName(dialect);
 | 
								String dbName = getSpringDbName(dialect);
 | 
				
			||||||
			return (dbName != null) ? new SQLErrorCodeSQLExceptionTranslator(dbName)
 | 
								return (dbName != null) ? new SQLErrorCodeSQLExceptionTranslator(dbName)
 | 
				
			||||||
					: new SQLStateSQLExceptionTranslator();
 | 
										: new SQLExceptionSubclassTranslator();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		private String getSpringDbName(SQLDialect dialect) {
 | 
							private String getSpringDbName(SQLDialect dialect) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,6 +17,7 @@
 | 
				
			||||||
package org.springframework.boot.autoconfigure.jooq;
 | 
					package org.springframework.boot.autoconfigure.jooq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.sql.SQLException;
 | 
					import java.sql.SQLException;
 | 
				
			||||||
 | 
					import java.sql.SQLSyntaxErrorException;
 | 
				
			||||||
import java.util.function.Function;
 | 
					import java.util.function.Function;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.jooq.Configuration;
 | 
					import org.jooq.Configuration;
 | 
				
			||||||
| 
						 | 
					@ -93,12 +94,19 @@ class DefaultExceptionTranslatorExecuteListenerTests {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static Object[] exceptionTranslatesSqlExceptions() {
 | 
						static Object[] exceptionTranslatesSqlExceptions() {
 | 
				
			||||||
		return new Object[] { new Object[] { SQLDialect.DERBY, sqlException("42802") },
 | 
							return new Object[] { new Object[] { SQLDialect.DERBY, sqlException("42802") },
 | 
				
			||||||
 | 
									new Object[] { SQLDialect.DERBY, new SQLSyntaxErrorException() },
 | 
				
			||||||
				new Object[] { SQLDialect.H2, sqlException(42000) },
 | 
									new Object[] { SQLDialect.H2, sqlException(42000) },
 | 
				
			||||||
 | 
									new Object[] { SQLDialect.H2, new SQLSyntaxErrorException() },
 | 
				
			||||||
				new Object[] { SQLDialect.HSQLDB, sqlException(-22) },
 | 
									new Object[] { SQLDialect.HSQLDB, sqlException(-22) },
 | 
				
			||||||
 | 
									new Object[] { SQLDialect.HSQLDB, new SQLSyntaxErrorException() },
 | 
				
			||||||
				new Object[] { SQLDialect.MARIADB, sqlException(1054) },
 | 
									new Object[] { SQLDialect.MARIADB, sqlException(1054) },
 | 
				
			||||||
 | 
									new Object[] { SQLDialect.MARIADB, new SQLSyntaxErrorException() },
 | 
				
			||||||
				new Object[] { SQLDialect.MYSQL, sqlException(1054) },
 | 
									new Object[] { SQLDialect.MYSQL, sqlException(1054) },
 | 
				
			||||||
 | 
									new Object[] { SQLDialect.MYSQL, new SQLSyntaxErrorException() },
 | 
				
			||||||
				new Object[] { SQLDialect.POSTGRES, sqlException("03000") },
 | 
									new Object[] { SQLDialect.POSTGRES, sqlException("03000") },
 | 
				
			||||||
				new Object[] { SQLDialect.SQLITE, sqlException("21000") } };
 | 
									new Object[] { SQLDialect.POSTGRES, new SQLSyntaxErrorException() },
 | 
				
			||||||
 | 
									new Object[] { SQLDialect.SQLITE, sqlException("21000") },
 | 
				
			||||||
 | 
									new Object[] { SQLDialect.SQLITE, new SQLSyntaxErrorException() } };
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private static SQLException sqlException(String sqlState) {
 | 
						private static SQLException sqlException(String sqlState) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue