Best code examples for Hibernate ORM ConstraintViolationException class (org.hibernate.exception.ConstraintViolationException)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM ConstraintViolationException class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Hibernate ORM ConstraintViolationException examples from Open Source projects
This code example shows how to use the following methods: getSQL, getConstraintName
			PessimisticLockException jdbcEx = (PessimisticLockException) ex; 
			return new PessimisticLockingFailureException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex); 
		} 
		if (ex instanceof ConstraintViolationException) { 
			ConstraintViolationException jdbcEx = (ConstraintViolationException) ex; 
			return new DataIntegrityViolationException(ex.getMessage()  + "; SQL [" + jdbcEx.getSQL() + 
					"]; constraint [" + jdbcEx.getConstraintName() + "]", ex); 
		} 
		if (ex instanceof DataException) { 
			DataException jdbcEx = (DataException) ex; 
			return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex); 
		} 
		if (ex instanceof JDBCException) { 
			return new HibernateJdbcException((JDBCException) ex); 
		} 
		// end of JDBCException (subclass) handling 
 
		if (ex instanceof QueryException) { 
			return new HibernateQueryException((QueryException) ex); 
		} 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getConstraintName, getSQL
      LockAcquisitionException jdbcEx = (LockAcquisitionException) ex;
      return new CannotAcquireLockException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex);
    } 
    if (ex instanceof ConstraintViolationException) {
      ConstraintViolationException jdbcEx = (ConstraintViolationException) ex;
      return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL()
          + "]; constraint [" + jdbcEx.getConstraintName() + "]", ex);
    } 
    if (ex instanceof DataException) {
      DataException jdbcEx = (DataException) ex;
      return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex);
    } 
    if (ex instanceof NonUniqueResultException) { return new IncorrectResultSizeDataAccessException(
        ex.getMessage(), 1, ex); }
    if (ex instanceof NonUniqueObjectException) { return new DuplicateKeyException(ex.getMessage(), ex); }
    if (ex instanceof PropertyValueException) { return new DataIntegrityViolationException(ex.getMessage(),
        ex); }
    if (ex instanceof PersistentObjectException) { return new InvalidDataAccessApiUsageException(
        ex.getMessage(), ex); }
    if (ex instanceof TransientObjectException) { return new InvalidDataAccessApiUsageException(
Full Snippet Info
5
CodeRank