org.hibernate.resource.transaction.backend.jta.internal.synchronization.ExceptionMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.resource.transaction.backend.jta.internal.synchronization;
import java.io.Serializable;
import javax.transaction.SystemException;
import org.hibernate.engine.spi.SessionImplementor;
/**
* A pluggable strategy for defining how the {@link javax.transaction.Synchronization} registered by Hibernate handles
* exceptions.
*
* @author Steve Ebersole
*/
public interface ExceptionMapper extends Serializable {
/**
* Map a JTA {@link javax.transaction.SystemException} to the appropriate runtime-based exception.
*
* @param message The message to use for the returned exception
* @param systemException The causal exception
*
* @return The appropriate exception to throw
*/
RuntimeException mapStatusCheckFailure(String message, SystemException systemException, SessionImplementor sessionImplementor);
/**
* Map an exception encountered during a managed flush to the appropriate runtime-based exception.
*
* @param message The message to use for the returned exception
* @param failure The causal exception
*
* @return The appropriate exception to throw
*/
RuntimeException mapManagedFlushFailure(String message, RuntimeException failure, SessionImplementor session);
}