public class EJBHelper extends Object
| Constructor and Description |
|---|
EJBHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Connection |
getConnection(Object resource,
String username,
String password)
Called in a managed environment to get a Connection from the application
server specific resource.
|
static String |
getDDLNamePrefix(Object info)
Returns name prefix for DDL files extracted from the info instance by the
application server specific code.
|
static TransactionManager |
getLocalTransactionManager()
Called in a managed environment to access a TransactionManager
for managing local transaction boundaries and synchronization
for local transaction completion.
|
static Connection |
getNonTransactionalConnection(Object resource,
String username,
String password)
Called in a managed environment to get a non-transactional Connection
from the application server specific resource.
|
static Transaction |
getTransaction()
Returns Transaction instance that can be used to register synchronizations.
|
static UserTransaction |
getUserTransaction()
Returns the UserTransaction associated with the calling thread.
|
static boolean |
isManaged()
Identifies the managed environment behavior.
|
static void |
notifyApplicationUnloaded(ClassLoader cl)
Called to notify a ApplicationLifeCycleEventListeners that an application
is unloaded.
|
static void |
postInvoke(Object im)
Called in a managed environment at the end of the Transaction.beforeCompletion()
to de-register the component with the app server if necessary.
|
static Object |
preInvoke(Object component)
Called at the beginning of the Transaction.beforeCompletion() to register
the component with the app server if necessary.
|
static void |
registerApplicationLifeCycleEventListener(ApplicationLifeCycleEventListener listener)
Called to register a ApplicationLifeCycleEventListener.
|
static void |
registerSynchronization(Transaction jta,
Synchronization sync)
Called in a managed environment to register internal Synchronization object
with the Transaction Synchronization.
|
static void |
registerTransactionHelper(TransactionHelper h)
Register class that implements TransactionHelper interface
Should be called by a static method at class initialization time.
|
static PersistenceManagerFactory |
replaceInternalPersistenceManagerFactory(PersistenceManagerFactory pmf)
Returns the hashed instance of PersistenceManagerFactory
that compares equal to the newly created instance or the instance
itself if it is not found.
|
static void |
setPersistenceManagerFactoryDefaults(PersistenceManagerFactory pmf)
Set environment specific default values for the given PersistenceManagerFactory.
|
static int |
translateStatus(int st)
Translates local representation of the Transaction Status to
javax.transaction.Status value.
|
static Statement |
unwrapStatement(Statement stmt)
This method unwraps given Statement and return the Statement from
JDBC driver if possible.
|
public static void registerTransactionHelper(TransactionHelper h)
h - application server specific implemetation of the TransactionHelper
interface.public static Transaction getTransaction()
TransactionHelper.getTransaction()public static UserTransaction getUserTransaction()
TransactionHelper.getUserTransaction()public static boolean isManaged()
public static int translateStatus(int st)
st - Status valueTransactionHelper.translateStatus(int st)public static PersistenceManagerFactory replaceInternalPersistenceManagerFactory(PersistenceManagerFactory pmf)
pmf - PersistenceManagerFactory instance to be replacedTransactionHelper.replaceInternalPersistenceManagerFactory(
PersistenceManagerFactory pmf)public static Object preInvoke(Object component)
component - an array of ObjectsTransactionHelper.preInvoke(Object component)public static void postInvoke(Object im)
im - implementation-specific ObjectTransactionHelper.postInvoke(Object im)public static void registerSynchronization(Transaction jta, Synchronization sync) throws RollbackException, SystemException
jta - the Transaction instance for the calling thread.sync - the internal Synchronization instance to register.javax.transaction.RollbackException.javax.transaction.SystemException.RollbackExceptionSystemExceptionTransaction.registerSynchronization(Synchronization sync),
TransactionHelper.registerSynchronization(Transaction jta,
Synchronization sync)public static Connection getConnection(Object resource, String username, String password) throws SQLException
resource - the application server specific resource.username - the resource username. If null, Connection is requested
without username and password validation.password - the password for the resource username.java.sql.SQLException.SQLExceptionpublic static Connection getNonTransactionalConnection(Object resource, String username, String password) throws SQLException
resource - the application server specific resource.username - the resource username. If null, Connection is requested
without username and password validation.password - the password for the resource username.java.sql.SQLException.SQLExceptionpublic static TransactionManager getLocalTransactionManager()
public static Statement unwrapStatement(Statement stmt)
public static void setPersistenceManagerFactoryDefaults(PersistenceManagerFactory pmf)
pmf - the PersistenceManagerFactory.public static String getDDLNamePrefix(Object info)
info - the instance to use for the name generation.public static void registerApplicationLifeCycleEventListener(ApplicationLifeCycleEventListener listener)
listener - An instance of ApplicationLifeCycleEventListener.public static void notifyApplicationUnloaded(ClassLoader cl)
cl - An instance of the ClassLoader that loaded the application.Copyright © 2017. All rights reserved.