All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha1
Show newest version
/*
 * 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.engine.transaction.jta.platform.spi;

import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;

import org.hibernate.service.Service;

/**
 * Defines how we interact with various JTA services on the given platform/environment.
 *
 * @author Steve Ebersole
 */
public interface JtaPlatform extends Service {

	/**
	 * Locate the {@link TransactionManager}
	 *
	 * @return The {@link TransactionManager}
	 */
	TransactionManager retrieveTransactionManager();

	/**
	 * Locate the {@link UserTransaction}
	 *
	 * @return The {@link UserTransaction}
	 */
	UserTransaction retrieveUserTransaction();

	/**
	 * Determine an identifier for the given transaction appropriate for use in caching/lookup usages.
	 * 

* Generally speaking the transaction itself will be returned here. This method was added specifically * for use in WebSphere and other unfriendly Java EE containers. * * @param transaction The transaction to be identified. * @return An appropriate identifier */ Object getTransactionIdentifier(Transaction transaction); /** * Can we currently register a {@link Synchronization}? * * @return True if registering a {@link Synchronization} is currently allowed; false otherwise. */ boolean canRegisterSynchronization(); /** * Register a JTA {@link Synchronization} in the means defined by the platform. * * @param synchronization The synchronization to register */ void registerSynchronization(Synchronization synchronization); /** * Obtain the current transaction status using whatever means is preferred for this platform * * @return The current status. * * @throws SystemException Indicates a problem access the underlying status */ int getCurrentStatus() throws SystemException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy