HHH-6199 - Split org.hibernate.exception package into api/spi/internal
This commit is contained in:
parent
4ee0d4237d
commit
a806626a27
|
@ -383,7 +383,7 @@ public interface AvailableSettings {
|
|||
public static final String HBM2DDL_IMPORT_FILES = "hibernate.hbm2ddl.import_files";
|
||||
|
||||
/**
|
||||
* The {@link org.hibernate.exception.SQLExceptionConverter} to use for converting SQLExceptions
|
||||
* The {@link org.hibernate.exception.spi.SQLExceptionConverter} to use for converting SQLExceptions
|
||||
* to Hibernate's JDBCException hierarchy. The default is to use the configured
|
||||
* {@link org.hibernate.dialect.Dialect}'s preferred SQLExceptionConverter.
|
||||
*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -57,9 +57,9 @@ import org.hibernate.dialect.lock.PessimisticReadSelectLockingStrategy;
|
|||
import org.hibernate.dialect.lock.PessimisticWriteSelectLockingStrategy;
|
||||
import org.hibernate.dialect.lock.SelectLockingStrategy;
|
||||
import org.hibernate.engine.jdbc.LobCreator;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.hibernate.exception.SQLStateConverter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.exception.internal.SQLStateConverter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.id.IdentityGenerator;
|
||||
import org.hibernate.id.SequenceGenerator;
|
||||
import org.hibernate.id.TableHiLoGenerator;
|
||||
|
|
|
@ -25,14 +25,15 @@ package org.hibernate.dialect;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
||||
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.jboss.logging.Logger;
|
||||
|
|
|
@ -27,6 +27,8 @@ import java.io.Serializable;
|
|||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
|
@ -45,8 +47,6 @@ import org.hibernate.dialect.lock.PessimisticReadSelectLockingStrategy;
|
|||
import org.hibernate.dialect.lock.PessimisticWriteSelectLockingStrategy;
|
||||
import org.hibernate.dialect.lock.SelectLockingStrategy;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.persister.entity.Lockable;
|
||||
|
|
|
@ -26,8 +26,8 @@ import java.sql.SQLException;
|
|||
import java.sql.Types;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
||||
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
|
|
|
@ -34,8 +34,8 @@ import org.hibernate.dialect.function.NvlFunction;
|
|||
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
||||
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.sql.CaseFragment;
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
|
@ -35,8 +36,7 @@ import org.hibernate.dialect.function.NvlFunction;
|
|||
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
||||
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
|
|
|
@ -35,8 +35,8 @@ import org.hibernate.dialect.function.PositionSubstringFunction;
|
|||
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
||||
import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.id.SequenceGenerator;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
package org.hibernate.dialect.resolver;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.hibernate.exception.internal.SQLStateConverter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.exception.SQLStateConverter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ import java.sql.SQLException;
|
|||
import java.sql.SQLWarning;
|
||||
import java.sql.Statement;
|
||||
|
||||
import org.hibernate.exception.internal.SQLStateConverter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.hibernate.exception.SQLStateConverter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.logging.Logger.Level;
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.hibernate.engine.jdbc.spi.JdbcServices;
|
|||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.engine.profile.FetchProfile;
|
||||
import org.hibernate.engine.query.spi.QueryPlanCache;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
|
|
@ -1,116 +1,123 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.exception;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
|
||||
/**
|
||||
* A SQLExceptionConverter implementation specific to Caché SQL,
|
||||
* accounting for its custom integrity constraint violation error codes.
|
||||
*
|
||||
* @author Jonathan Levinson
|
||||
*/
|
||||
public class CacheSQLStateConverter implements SQLExceptionConverter {
|
||||
|
||||
private ViolatedConstraintNameExtracter extracter;
|
||||
|
||||
private static final Set SQL_GRAMMAR_CATEGORIES = new HashSet();
|
||||
private static final Set DATA_CATEGORIES = new HashSet();
|
||||
private static final Set INTEGRITY_VIOLATION_CATEGORIES = new HashSet();
|
||||
private static final Set CONNECTION_CATEGORIES = new HashSet();
|
||||
|
||||
static {
|
||||
SQL_GRAMMAR_CATEGORIES.add( "07" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "37" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "42" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "65" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "S0" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "20" );
|
||||
|
||||
DATA_CATEGORIES.add( "22" );
|
||||
DATA_CATEGORIES.add( "21" );
|
||||
DATA_CATEGORIES.add( "02" );
|
||||
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 119 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 120 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 121 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 122 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 123 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 124 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 125 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 127 ) );
|
||||
|
||||
CONNECTION_CATEGORIES.add( "08" );
|
||||
}
|
||||
|
||||
public CacheSQLStateConverter(ViolatedConstraintNameExtracter extracter) {
|
||||
this.extracter = extracter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
Integer errorCode = new Integer( JdbcExceptionHelper.extractErrorCode( sqlException ) );
|
||||
if ( sqlStateClassCode != null ) {
|
||||
if ( SQL_GRAMMAR_CATEGORIES.contains( sqlStateClassCode ) ) {
|
||||
return new SQLGrammarException( message, sqlException, sql );
|
||||
}
|
||||
else if ( INTEGRITY_VIOLATION_CATEGORIES.contains( errorCode ) ) {
|
||||
String constraintName = extracter.extractConstraintName( sqlException );
|
||||
return new ConstraintViolationException( message, sqlException, sql, constraintName );
|
||||
}
|
||||
else if ( CONNECTION_CATEGORIES.contains( sqlStateClassCode ) ) {
|
||||
return new JDBCConnectionException( message, sqlException, sql );
|
||||
}
|
||||
else if ( DATA_CATEGORIES.contains( sqlStateClassCode ) ) {
|
||||
return new DataException( message, sqlException, sql );
|
||||
}
|
||||
}
|
||||
return handledNonSpecificException( sqlException, message, sql );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an exception not converted to a specific type based on the SQLState.
|
||||
*
|
||||
* @param sqlException The exception to be handled.
|
||||
* @param message An optional message
|
||||
* @param sql Optionally, the sql being performed when the exception occurred.
|
||||
* @return The converted exception; should <b>never</b> be null.
|
||||
*/
|
||||
protected JDBCException handledNonSpecificException(SQLException sqlException, String message, String sql) {
|
||||
return new GenericJDBCException( message, sqlException, sql );
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.exception.internal;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.exception.ConstraintViolationException;
|
||||
import org.hibernate.exception.DataException;
|
||||
import org.hibernate.exception.GenericJDBCException;
|
||||
import org.hibernate.exception.JDBCConnectionException;
|
||||
import org.hibernate.exception.SQLGrammarException;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
|
||||
/**
|
||||
* A SQLExceptionConverter implementation specific to Caché SQL,
|
||||
* accounting for its custom integrity constraint violation error codes.
|
||||
*
|
||||
* @author Jonathan Levinson
|
||||
*/
|
||||
public class CacheSQLStateConverter implements SQLExceptionConverter {
|
||||
|
||||
private ViolatedConstraintNameExtracter extracter;
|
||||
|
||||
private static final Set SQL_GRAMMAR_CATEGORIES = new HashSet();
|
||||
private static final Set DATA_CATEGORIES = new HashSet();
|
||||
private static final Set INTEGRITY_VIOLATION_CATEGORIES = new HashSet();
|
||||
private static final Set CONNECTION_CATEGORIES = new HashSet();
|
||||
|
||||
static {
|
||||
SQL_GRAMMAR_CATEGORIES.add( "07" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "37" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "42" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "65" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "S0" );
|
||||
SQL_GRAMMAR_CATEGORIES.add( "20" );
|
||||
|
||||
DATA_CATEGORIES.add( "22" );
|
||||
DATA_CATEGORIES.add( "21" );
|
||||
DATA_CATEGORIES.add( "02" );
|
||||
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 119 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 120 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 121 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 122 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 123 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 124 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 125 ) );
|
||||
INTEGRITY_VIOLATION_CATEGORIES.add( new Integer( 127 ) );
|
||||
|
||||
CONNECTION_CATEGORIES.add( "08" );
|
||||
}
|
||||
|
||||
public CacheSQLStateConverter(ViolatedConstraintNameExtracter extracter) {
|
||||
this.extracter = extracter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
Integer errorCode = new Integer( JdbcExceptionHelper.extractErrorCode( sqlException ) );
|
||||
if ( sqlStateClassCode != null ) {
|
||||
if ( SQL_GRAMMAR_CATEGORIES.contains( sqlStateClassCode ) ) {
|
||||
return new SQLGrammarException( message, sqlException, sql );
|
||||
}
|
||||
else if ( INTEGRITY_VIOLATION_CATEGORIES.contains( errorCode ) ) {
|
||||
String constraintName = extracter.extractConstraintName( sqlException );
|
||||
return new ConstraintViolationException( message, sqlException, sql, constraintName );
|
||||
}
|
||||
else if ( CONNECTION_CATEGORIES.contains( sqlStateClassCode ) ) {
|
||||
return new JDBCConnectionException( message, sqlException, sql );
|
||||
}
|
||||
else if ( DATA_CATEGORIES.contains( sqlStateClassCode ) ) {
|
||||
return new DataException( message, sqlException, sql );
|
||||
}
|
||||
}
|
||||
return handledNonSpecificException( sqlException, message, sql );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an exception not converted to a specific type based on the SQLState.
|
||||
*
|
||||
* @param sqlException The exception to be handled.
|
||||
* @param message An optional message
|
||||
* @param sql Optionally, the sql being performed when the exception occurred.
|
||||
* @return The converted exception; should <b>never</b> be null.
|
||||
*/
|
||||
protected JDBCException handledNonSpecificException(SQLException sqlException, String message, String sql) {
|
||||
return new GenericJDBCException( message, sqlException, sql );
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,16 +20,24 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.exception;
|
||||
package org.hibernate.exception.internal;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.PessimisticLockException;
|
||||
import org.hibernate.QueryTimeoutException;
|
||||
import org.hibernate.exception.ConstraintViolationException;
|
||||
import org.hibernate.exception.DataException;
|
||||
import org.hibernate.exception.GenericJDBCException;
|
||||
import org.hibernate.exception.JDBCConnectionException;
|
||||
import org.hibernate.exception.LockAcquisitionException;
|
||||
import org.hibernate.exception.SQLGrammarException;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.util.JdbcExceptionHelper;
|
||||
|
||||
/**
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,11 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.exception;
|
||||
package org.hibernate.exception.spi;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
/**
|
||||
|
@ -33,8 +34,6 @@ import org.hibernate.HibernateException;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface Configurable {
|
||||
// todo: this might really even be moved into the cfg package and used as the basis for all things which are configurable.
|
||||
|
||||
/**
|
||||
* Configure the component, using the given settings and properties.
|
||||
*
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,12 +20,12 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.exception;
|
||||
package org.hibernate.exception.spi;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.hibernate.JDBCException;
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ import org.hibernate.JDBCException;
|
|||
* Implementations <b>must</b> have a constructor which takes a
|
||||
* {@link ViolatedConstraintNameExtracter} parameter.
|
||||
* <p/>
|
||||
* Implementations may implement {@link Configurable} if they need to perform
|
||||
* Implementations may implement {@link org.hibernate.exception.spi.Configurable} if they need to perform
|
||||
* configuration steps prior to first use.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
|
@ -49,7 +49,7 @@ public interface SQLExceptionConverter extends Serializable {
|
|||
* @param sqlException The SQLException to be converted.
|
||||
* @param message An optional error message.
|
||||
* @return The resulting JDBCException.
|
||||
* @see ConstraintViolationException, JDBCConnectionException, SQLGrammarException, LockAcquisitionException
|
||||
* @see org.hibernate.exception.ConstraintViolationException , JDBCConnectionException, SQLGrammarException, LockAcquisitionException
|
||||
*/
|
||||
public JDBCException convert(SQLException sqlException, String message, String sql);
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,23 +20,24 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.exception;
|
||||
package org.hibernate.exception.spi;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.exception.GenericJDBCException;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* A factory for building SQLExceptionConverter instances.
|
||||
*
|
||||
|
@ -79,7 +80,7 @@ public class SQLExceptionConverterFactory {
|
|||
|
||||
if ( converter instanceof Configurable ) {
|
||||
try {
|
||||
( ( Configurable ) converter ).configure( properties );
|
||||
( (Configurable) converter ).configure( properties );
|
||||
}
|
||||
catch ( HibernateException e ) {
|
||||
LOG.unableToConfigureSqlExceptionConverter(e);
|
||||
|
@ -92,7 +93,7 @@ public class SQLExceptionConverterFactory {
|
|||
|
||||
/**
|
||||
* Builds a minimal converter. The instance returned here just always converts to
|
||||
* {@link GenericJDBCException}.
|
||||
* {@link org.hibernate.exception.GenericJDBCException}.
|
||||
*
|
||||
* @return The minimal converter.
|
||||
*/
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,8 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.exception;
|
||||
|
||||
package org.hibernate.exception.spi;
|
||||
|
||||
/**
|
||||
* Knows how to extract a violated constraint name from an error message based on the
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,9 +20,9 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.exception;
|
||||
package org.hibernate.exception.spi;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
|
@ -99,7 +99,7 @@ import org.hibernate.engine.profile.FetchProfile;
|
|||
import org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification;
|
||||
import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl;
|
||||
import org.hibernate.engine.transaction.spi.TransactionEnvironment;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import org.hibernate.id.UUIDGenerator;
|
||||
import org.hibernate.id.factory.IdentifierGeneratorFactory;
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
|
|||
import org.hibernate.engine.spi.PersistenceContext;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SubselectFetch;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.QueryException;
|
||||
|
@ -59,7 +60,6 @@ import org.hibernate.dialect.Dialect;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.jdbc.batch.internal.BasicBatchKey;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import org.hibernate.internal.FilterHelper;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.mapping.Table;
|
||||
|
||||
|
|
Loading…
Reference in New Issue