public class TransactionFactoryImpl extends Object implements js.transaction.TransactionFactory, js.transaction.TransactionContext
TransactionFactory
interface. This transaction factory implementation
creates a new Java Proxy that executes methods inside a transaction. When create factory instance need to provide
resource name for Hibernate configuration XML file, see TransactionFactoryImpl(String)
. There is also a
convenient constructor that uses default resource name, hibernate.cfg.xml
.
This transaction factory recognize only one single argument of type SessionManager
. Therefore constructor
signature should be as in sample code. Also optional arguments from newInstance(Class, Object...)
are not
used.
class DaoImpl implements Dao { DaoImpl(SessionManager sm) { } } ... Dao dao = factory.newInstance(DaoImpl.class);
Modifier and Type | Class and Description |
---|---|
private class |
TransactionFactoryImpl.TransactionalProxy
Java invocation handler for transactional Proxy.
|
Modifier and Type | Field and Description |
---|---|
private static js.log.Log |
log |
private js.transaction.TransactionManager |
manager |
private ThreadLocal<Object> |
sessionStorage |
Constructor and Description |
---|
TransactionFactoryImpl()
Convenient constructor using default Hibernate configuration file,
hibernate.cfg.xml . |
TransactionFactoryImpl(String configResource)
Create transaction factory instance and configure it from given resource name.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
getSession() |
<I> I |
newInstance(Class<? extends I> implementationClass,
Object... args) |
private static final js.log.Log log
private final js.transaction.TransactionManager manager
private final ThreadLocal<Object> sessionStorage
public TransactionFactoryImpl()
hibernate.cfg.xml
.public TransactionFactoryImpl(String configResource)
configResource
- resource name for Hibernate configuration.Copyright © 2019. All rights reserved.