Package org.hibernate.exception

Examples of org.hibernate.exception.GenericJDBCException


    sessionControl.setReturnValue(true, 1);
    tx.commit();
    SQLException sqlEx = new SQLException("argh", "27");
    Exception rootCause = null;
    if (fallbackTranslation) {
      GenericJDBCException jdbcEx = new GenericJDBCException("mymsg", sqlEx);
      txControl.setThrowable(jdbcEx, 1);
      rootCause = sqlEx;
    }
    else {
      ConstraintViolationException jdbcEx = new ConstraintViolationException("mymsg", sqlEx, null);
View Full Code Here


  }

  public void testFallbackExceptionTranslation() throws HibernateException {
    SQLException sqlEx = new SQLException("argh", "27");

    final GenericJDBCException gjex = new GenericJDBCException("mymsg", sqlEx);
    try {
      createTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(org.hibernate.Session session) throws HibernateException {
          throw gjex;
        }
View Full Code Here

      try {
        return toCallableStatement( statement ).getInt( parameterPosition );
      }
      catch( SQLException sqle ) {
        sqlExceptionHelper.logExceptions( sqle, "could not extract row counts from CallableStatement" );
        throw new GenericJDBCException( "could not extract row counts from CallableStatement", sqle );
      }
    }
View Full Code Here

   * @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 );
  }
View Full Code Here

   * @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 );
  }
View Full Code Here

   * @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 );
  }
View Full Code Here

   * @return The minimal converter.
   */
  public static SQLExceptionConverter buildMinimalSQLExceptionConverter() {
    return new SQLExceptionConverter() {
      public JDBCException convert(SQLException sqlException, String message, String sql) {
        return new GenericJDBCException( message, sqlException, sql );
      }
    };
  }
View Full Code Here

    given(session.beginTransaction()).willReturn(tx);
    given(session.isOpen()).willReturn(true);
    SQLException sqlEx = new SQLException("argh", "27");
    Exception rootCause = null;
    if (fallbackTranslation) {
      GenericJDBCException jdbcEx = new GenericJDBCException("mymsg", sqlEx);
      rootCause = sqlEx;
      willThrow(jdbcEx).given(tx).commit();
    }
    else {
      ConstraintViolationException jdbcEx = new ConstraintViolationException("mymsg", sqlEx, null);
View Full Code Here

  @Test
  public void testFallbackExceptionTranslation() throws HibernateException {
    SQLException sqlEx = new SQLException("argh", "27");

    final GenericJDBCException gjex = new GenericJDBCException("mymsg", sqlEx);
    try {
      hibernateTemplate.execute(new HibernateCallback<Object>() {
        @Override
        public Object doInHibernate(org.hibernate.Session session) throws HibernateException {
          throw gjex;
View Full Code Here

    else if ( SQLSyntaxErrorException.class.isInstance( sqlException ) ) {
      return new SQLGrammarException( message, sqlException, sql );
    }
    else if ( SQLTimeoutException.class.isInstance( sqlException ) ) {
      // there are no corresponding sql states for this type
      return new GenericJDBCException( message, sqlException, sql );
    }
    else if ( SQLTransactionRollbackException.class.isInstance( sqlException ) ) {
      // Not 100% sure this is completely accurate.  The JavaDocs for SQLTransactionRollbackException state that
      // it indicates sql states starting with '40' and that those usually indicate that:
      //    <quote>
View Full Code Here

TOP

Related Classes of org.hibernate.exception.GenericJDBCException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.