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

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

Hibernate ORM JDBCException examples from Open Source projects
This code example shows how to use the following methods: getMessage, getErrorCode, getSQLState
@SuppressWarnings("serial") 
public class HibernateJdbcException extends UncategorizedDataAccessException {
 
	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();
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: getErrorCode, getSQL, getSQLState, getMessage
 */ 
@SuppressWarnings("serial") 
public class HibernateJdbcException extends UncategorizedDataAccessException {
 
	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() {
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: getMessage, getSQL, getSQLException
	 */ 
	protected DataAccessException convertHibernateAccessException(HibernateException ex) {
		if (this.jdbcExceptionTranslator != null && ex instanceof JDBCException) {
			JDBCException jdbcEx = (JDBCException) ex;
			return this.jdbcExceptionTranslator.translate(
					"Hibernate operation: " + jdbcEx.getMessage(), jdbcEx.getSQL(), jdbcEx.getSQLException());
		} 
		return SessionFactoryUtils.convertHibernateAccessException(ex);
	} 
 
} 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getMessage, getErrorCode, getSQLState
import org.hibernate.QueryTimeoutException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.StaleObjectStateException;
import org.hibernate.StaleStateException;
import org.hibernate.TransientObjectException;
import org.hibernate.UnresolvableObjectException;
import org.hibernate.WrongClassException;
import org.hibernate.dialect.lock.OptimisticEntityLockException;
import org.hibernate.dialect.lock.PessimisticEntityLockException;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.DataException;
import org.hibernate.exception.JDBCConnectionException;
import org.hibernate.exception.LockAcquisitionException;
import org.hibernate.exception.SQLGrammarException;
import org.hibernate.service.spi.Wrapped;
 
import org.springframework.dao.CannotAcquireLockException; 
import org.springframework.dao.DataAccessException; 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: getMessage, getSQL, getSQLException
 
	private DataAccessException translateException(HibernateException ex) {
		if (this.jdbcExceptionTranslator != null && ex instanceof JDBCException) {
			JDBCException jdbcEx = (JDBCException) ex;
			return this.jdbcExceptionTranslator.translate(
					"Hibernate flushing: " + jdbcEx.getMessage(), jdbcEx.getSQL(), jdbcEx.getSQLException());
		} 
		return SessionFactoryUtils.convertHibernateAccessException(ex);
	} 
 
	@Override 
	public void beforeCompletion() { 
		if (this.jtaTransaction != null) {
			// Typically in case of a suspended JTA transaction: 
			// Remove the Session for the current JTA transaction, but keep the holder. 
			Session session = this.sessionHolder.removeSession(this.jtaTransaction);
			if (session != null) {
				if (this.sessionHolder.isEmpty()) {
					// No Sessions for JTA transactions bound anymore -> could remove it. 
					TransactionSynchronizationManager.unbindResourceIfPossible(this.sessionFactory);
Full Snippet Info
8
CodeRank
See Code Examples for Hibernate ORM JDBCException Methods: