@Override public Clob createClob(String string) { try { final Clob clob = createClob(); clob.setString( 1, string ); return clob; } catch ( SQLException e ) { throw new JDBCException( "Unable to set CLOB string after creation", e ); } }
/** * Convert the given HibernateException to an appropriate exception from the * {@code org.springframework.dao} hierarchy. * <p>Will automatically apply a specified SQLExceptionTranslator to a * Hibernate JDBCException, otherwise rely on Hibernate's default translation. * @param ex the HibernateException that occurred * @return a corresponding DataAccessException * @see SessionFactoryUtils#convertHibernateAccessException */ protected DataAccessException convertHibernateAccessException(HibernateException ex) { if (this.jdbcExceptionTranslator != null && ex instanceof JDBCException) { JDBCException jdbcEx = (JDBCException) ex; DataAccessException dae = this.jdbcExceptionTranslator.translate( "Hibernate operation: " + jdbcEx.getMessage(), jdbcEx.getSQL(), jdbcEx.getSQLException()); if (dae != null) { throw dae; } } return SessionFactoryUtils.convertHibernateAccessException(ex); }
public HibernateJdbcException(JDBCException ex) { super("JDBC exception on Hibernate data access: SQLException for SQL [" + ex.getSQL() + "]; SQL state [" + ex.getSQLState() + "]; error code [" + ex.getErrorCode() + "]; " + ex.getMessage(), ex); }
/** * Return the underlying SQLException. */ public SQLException getSQLException() { return ((JDBCException) getCause()).getSQLException(); }
/** * Return the SQL that led to the problem. */ public String getSql() { return ((JDBCException) getCause()).getSQL(); }
log.warn("Exception while trying to get indexinfo on " + TableNameQualifier.qualify(table.getCatalog(), table.getSchema(), table.getName() ) + "=" + t.getMessage() );
private void checkException(Session mainSession, PersistenceException e) { final Throwable cause = e.getCause(); if ( cause instanceof JDBCException ) { // SQLServer will report this condition via a SQLException // when using its SNAPSHOT transaction isolation... if ( !(getDialect() instanceof SQLServerDialect && ((JDBCException) cause).getErrorCode() == 3960) ) { throw e; } else { // it seems to "lose track" of the transaction as well... mainSession.getTransaction().rollback(); mainSession.beginTransaction(); } } else if ( !(cause instanceof StaleObjectStateException) && !(cause instanceof StaleStateException) ) { fail( "expectd StaleObjectStateException or StaleStateException exception but is" + cause ); } }
/** * Return the underlying SQLException. */ public SQLException getSQLException() { return ((JDBCException) getCause()).getSQLException(); }
/** * Return the SQL that led to the problem. */ public String getSql() { return ((JDBCException) getCause()).getSQL(); }
log.warn("Exception while trying to get indexinfo on " + TableNameQualifier.qualify(table.getCatalog(), table.getSchema(), table.getName() ) + "=" + t.getMessage() );
@Override public NClob createNClob(String string) { try { final NClob nclob = createNClob(); nclob.setString( 1, string ); return nclob; } catch ( SQLException e ) { throw new JDBCException( "Unable to set NCLOB string after creation", e ); } }
/** * Convert the given HibernateException to an appropriate exception from the * {@code org.springframework.dao} hierarchy. * <p>Will automatically apply a specified SQLExceptionTranslator to a * Hibernate JDBCException, otherwise rely on Hibernate's default translation. * @param ex the HibernateException that occurred * @return a corresponding DataAccessException * @see SessionFactoryUtils#convertHibernateAccessException */ protected DataAccessException convertHibernateAccessException(HibernateException ex) { if (this.jdbcExceptionTranslator != null && ex instanceof JDBCException) { JDBCException jdbcEx = (JDBCException) ex; DataAccessException dae = this.jdbcExceptionTranslator.translate( "Hibernate operation: " + jdbcEx.getMessage(), jdbcEx.getSQL(), jdbcEx.getSQLException()); if (dae != null) { throw dae; } } return SessionFactoryUtils.convertHibernateAccessException(ex); }
public HibernateJdbcException(JDBCException ex) { super("JDBC exception on Hibernate data access: SQLException for SQL [" + ex.getSQL() + "]; SQL state [" + ex.getSQLState() + "]; error code [" + ex.getErrorCode() + "]; " + ex.getMessage(), ex); }
public QueryTimeoutException( String s, JDBCException je, String sql ) { super(s, je.getSQLException(), sql); }
/** * Return the SQL that led to the problem. */ public String getSql() { return ((JDBCException) getCause()).getSQL(); }
@Override public Blob createBlob(byte[] bytes) { try { final Blob blob = createBlob(); blob.setBytes( 1, bytes ); return blob; } catch ( SQLException e ) { throw new JDBCException( "Unable to set BLOB bytes after creation", e ); } }
JDBCException jdbcEx = (JDBCException) ex; DataAccessException dae = this.jdbcExceptionTranslator.translate( "Hibernate operation: " + jdbcEx.getMessage(), jdbcEx.getSQL(), jdbcEx.getSQLException()); if (dae != null) { throw dae;
public HibernateJdbcException(JDBCException ex) { super("JDBC exception on Hibernate data access: SQLException for SQL [" + ex.getSQL() + "]; SQL state [" + ex.getSQLState() + "]; error code [" + ex.getErrorCode() + "]; " + ex.getMessage(), ex); }
public QueryTimeoutException( String s, JDBCException je, String sql ) { super(s, je.getSQLException(), sql); }
/** * Return the SQL that led to the problem. */ public String getSql() { return ((JDBCException) getCause()).getSQL(); }