Code example for JDBCException

Methods: getMessagegetSQLgetSQLException

0
 
	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);