return new SQLGrammarException( message, sqlException, sql );
return new SQLGrammarException( message, sqlException, sql );
throw new SQLGrammarException( message, sqlException, sql );
@Override public JDBCException convert(SQLException sqlException, String message, String sql) { final String sqlState = JdbcExceptionHelper .extractSqlState(sqlException); if (sqlState != null) { if (SQL_GRAMMAR_CATEGORIES.contains(sqlState)) { return new SQLGrammarException(message, sqlException, sql); } else if (DATA_CATEGORIES.contains(sqlState)) { return new DataException(message, sqlException, sql); } else if (LOCK_ACQUISITION_CATEGORIES.contains(sqlState)) { return new LockAcquisitionException(message, sqlException, sql); } } return null; } };
@Override public JDBCException convert(SQLException sqlException, String message, String sql) { final String sqlState = JdbcExceptionHelper .extractSqlState(sqlException); if (sqlState != null) { if (SQL_GRAMMAR_CATEGORIES.contains(sqlState)) { return new SQLGrammarException(message, sqlException, sql); } else if (DATA_CATEGORIES.contains(sqlState)) { return new DataException(message, sqlException, sql); } else if (LOCK_ACQUISITION_CATEGORIES.contains(sqlState)) { return new LockAcquisitionException(message, sqlException, sql); } } return null; } };
return new SQLGrammarException( message, sqlException, sql );
return new SQLGrammarException( message, sqlException, sql );
/** * Convert the given SQLException into Hibernate's JDBCException hierarchy. * * @param sqlException The SQLException to be converted. * @param message An optional error message. * @param sql Optionally, the sql being performed when the exception occurred. * @return The resulting JDBCException. */ public JDBCException convert(SQLException sqlException, String message, String sql) { String sqlStateClassCode = JDBCExceptionHelper.extractSqlStateClassCode( sqlException ); if ( sqlStateClassCode != null ) { if ( SQL_GRAMMAR_CATEGORIES.contains( sqlStateClassCode ) ) { return new SQLGrammarException( message, sqlException, sql ); } else if ( INTEGRITY_VIOLATION_CATEGORIES.contains( sqlStateClassCode ) ) { String constraintName = extracter.extractConstraintName( sqlException ); return new ConstraintViolationException( message, sqlException, sql, constraintName ); } else if ( CONNECTION_CATEGORIES.contains( sqlStateClassCode ) ) { return new JDBCConnectionException( message, sqlException, sql ); } } return handledNonSpecificException( sqlException, message, sql ); }
throw new SQLGrammarException("foo",null);
return new SQLGrammarException( message, sqlException, sql );
return new SQLGrammarException( message, sqlException, sql );
return new SQLGrammarException( message, sqlException, sql );
return new SQLGrammarException( message, sqlException, sql );
return new SQLGrammarException( message, sqlException, sql );
throw new SQLGrammarException( message, sqlException, sql );
/** * Convert the given SQLException into Hibernate's JDBCException hierarchy. * * @param sqlException The SQLException to be converted. * @param message An optional error message. * @param sql Optionally, the sql being performed when the exception occurred. * @return The resulting JDBCException. */ public JDBCException convert(SQLException sqlException, String message, String sql) { int errorCode = JDBCExceptionHelper.extractErrorCode( sqlException ); if ( isMatch( getConnectionErrorCodes(), errorCode ) ) { return new JDBCConnectionException( message, sqlException, sql ); } else if ( isMatch( getSQLGrammarErrorCodes(), errorCode ) ) { return new SQLGrammarException( message, sqlException, sql ); } else if ( isMatch( getIntegrityViolationErrorCodes(), errorCode ) ) { String constraintName = extracter.extractConstraintName( sqlException ); return new ConstraintViolationException( message, sqlException, sql, constraintName ); } else if ( isMatch( getLockAcquisitionErrorCodes(), errorCode ) ) { return new LockAcquisitionException( message, sqlException, sql ); } return handledNonSpecificException( sqlException, message, sql ); }
return adaptQueryException((net.sf.hibernate.QueryException) ex); if (ex instanceof net.sf.hibernate.exception.SQLGrammarException) return new org.hibernate.exception.SQLGrammarException(ex.getMessage(), getSQLExceptionFromThrowable(ex.getCause())); if (ex instanceof net.sf.hibernate.type.SerializationException) return new org.hibernate.type.SerializationException(ex.getMessage(), getCauseAsException(ex));