Package org.springframework.dao

Examples of org.springframework.dao.DataAccessResourceFailureException


                EntityManager em = createEntityManager();
                TransactionSynchronizationManager.bindResource(
                        getEntityManagerFactory(), new EntityManagerHolder(em));
            }
            catch (PersistenceException ex) {
                throw new DataAccessResourceFailureException("Could not create JPA EntityManager", ex);
            }
        }
    }
View Full Code Here


    try {
      return doGetSession(sessionFactory, null, null, allowCreate);
    }
    catch (HibernateException ex) {
      throw new DataAccessResourceFailureException("Could not open Hibernate Session", ex);
    }
  }
View Full Code Here

    try {
      return doGetSession(sessionFactory, entityInterceptor, jdbcExceptionTranslator, true);
    }
    catch (HibernateException ex) {
      throw new DataAccessResourceFailureException("Could not open Hibernate Session", ex);
    }
  }
View Full Code Here

        // No transaction active -> simply return default thread-bound Session, if any
        // (possibly from OpenSessionInViewFilter/Interceptor).
        return sessionHolder.getValidatedSession();
      }
      catch (Throwable ex) {
        throw new DataAccessResourceFailureException("Could not check JTA transaction", ex);
      }
    }
    else {
      // No JTA TransactionManager -> simply return default thread-bound Session, if any
      // (possibly from OpenSessionInViewFilter/Interceptor).
View Full Code Here

            }
          }
        }
      }
      catch (Throwable ex) {
        throw new DataAccessResourceFailureException(
            "Could not register synchronization with JTA TransactionManager", ex);
      }
    }
  }
View Full Code Here

          return sessionFactory.openSession();
        }
      }
    }
    catch (HibernateException ex) {
      throw new DataAccessResourceFailureException("Could not open Hibernate Session", ex);
    }
  }
View Full Code Here

   * @see HibernateAccessor#convertHibernateAccessException
   * @see HibernateTransactionManager#convertHibernateAccessException
   */
  public static DataAccessException convertHibernateAccessException(HibernateException ex) {
    if (ex instanceof JDBCConnectionException) {
      return new DataAccessResourceFailureException(ex.getMessage(), ex);
    }
    if (ex instanceof SQLGrammarException) {
      return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof DataException) {
View Full Code Here

      }
      else if (INTEGRITY_VIOLATION_CODES.contains(classCode)) {
        return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
      }
      else if (RESOURCE_FAILURE_CODES.contains(classCode)) {
        return new DataAccessResourceFailureException(buildMessage(task, sql, ex), ex);
      }
      else if (CONCURRENCY_CODES.contains(classCode)) {
        return new ConcurrencyFailureException(buildMessage(task, sql, ex), ex);
      }
    }
View Full Code Here

          logTranslation(task, sql, sqlExToUse, false);
          return new InvalidResultSetAccessException(task, sql, sqlExToUse);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getDataAccessResourceFailureCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlExToUse, false);
          return new DataAccessResourceFailureException(buildMessage(task, sql, sqlExToUse), sqlExToUse);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getPermissionDeniedCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlExToUse, false);
          return new PermissionDeniedDataAccessException(buildMessage(task, sql, sqlExToUse), sqlExToUse);
        }
View Full Code Here

   * @param ex
   * @return
   */
  public static DataAccessException translateException(Exception ex) {
    if (ex instanceof DatabaseFileLockedException) {
      return new DataAccessResourceFailureException("database is already locked ", ex);
    }
    if (ex instanceof ObjectNotStorableException)
      return new InvalidDataAccessApiUsageException("object not storable ", ex);

    if (ex instanceof OldFormatException)
      return new DataAccessResourceFailureException("database is in old format", ex);

    if (ex instanceof IOException)
      return new DataAccessResourceFailureException("cannot do backup ", ex);

    // fallback
    return new Db4oSystemException(ex);
  }
View Full Code Here

TOP

Related Classes of org.springframework.dao.DataAccessResourceFailureException

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.