Package org.hibernate.exception

Examples of org.hibernate.exception.SQLExceptionConverter


    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );
   
    //SQL Exception converter:
   
    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here


    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );

    //SQL Exception converter:

    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here

    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );

    //SQL Exception converter:

    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here

    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );

    //SQL Exception converter:

    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here

    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );

    //SQL Exception converter:

    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here

    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );
   
    //SQL Exception converter:
   
    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here

    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );
   
    //SQL Exception converter:
   
    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here

    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );

    //SQL Exception converter:

    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here

    if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) );

    //SQL Exception converter:

    SQLExceptionConverter sqlExceptionConverter;
    try {
      sqlExceptionConverter = SQLExceptionConverterFactory.buildSQLExceptionConverter( dialect, properties );
    }
    catch(HibernateException e) {
      log.warn("Error building SQLExceptionConverter; using minimal converter");
View Full Code Here

    if ( getDialect() instanceof MySQLMyISAMDialect ) {
      reportSkip( "MySQL (ISAM) does not support FK violation checking", "exception conversion" );
      return;
    }

    SQLExceptionConverter converter = getDialect().buildSQLExceptionConverter();

    Session session = openSession();
    session.beginTransaction();
    Connection connection = session.connection();

    // Attempt to insert some bad values into the T_MEMBERSHIP table that should
    // result in a constraint violation
    PreparedStatement ps = null;
    try {
      ps = connection.prepareStatement("INSERT INTO T_MEMBERSHIP (user_id, group_id) VALUES (?, ?)");
      ps.setLong(1, 52134241);    // Non-existent user_id
      ps.setLong(2, 5342);        // Non-existent group_id
      ps.executeUpdate();

      fail("INSERT should have failed");
    }
    catch(SQLException sqle) {
      JDBCExceptionReporter.logExceptions(sqle, "Just output!!!!");
      JDBCException jdbcException = converter.convert(sqle, null, null);
      assertEquals( "Bad conversion [" + sqle.getMessage() + "]", ConstraintViolationException.class , jdbcException.getClass() );
      ConstraintViolationException ex = (ConstraintViolationException) jdbcException;
      System.out.println("Violated constraint name: " + ex.getConstraintName());
    }
    finally {
View Full Code Here

TOP

Related Classes of org.hibernate.exception.SQLExceptionConverter

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.