
Classes | |
| class | HibernateUtilException |
Public Member Functions | |
| void | setConfiguration (Properties extraProperties) |
| void | setConfiguration (Configuration config) |
| SessionFactory | getSessionFactory () |
| Configuration | getConfiguration () |
| void | rebuildSessionFactory () throws HibernateUtilException |
| void | rebuildSessionFactory (Configuration cfg) throws HibernateUtilException |
| Session | getSession () throws HibernateUtilException |
| void | closeSession () throws HibernateUtilException |
| void | beginTransaction () throws HibernateUtilException |
| void | commitTransaction () throws HibernateUtilException |
| void | rollbackTransaction () throws HibernateUtilException |
| void | reconnect (Session session) throws HibernateUtilException |
| Session | disconnectSession () throws HibernateUtilException |
| void | registerInterceptor (Interceptor interceptor) |
| List | getList (Class type) throws HibernateUtilException |
Static Public Member Functions | |
| static synchronized HibernateUtil | getInstance (Logger logger) |
| static void | clearInstance () |
Static Public Attributes | |
| static final String | HIBERNATE_FILENAME_DEFAULT = "cdb_rdb-hibernate.cfg.xml" |
Private Member Functions | |
| final String | getConfigurationFileName () |
| HibernateUtil (Logger logger) | |
| Interceptor | getInterceptor () |
Private Attributes | |
| final Logger | logger |
| Configuration | configuration |
| SessionFactory | sessionFactory |
| final ThreadLocal | threadSession = new ThreadLocal() |
| final ThreadLocal | threadTransaction = new ThreadLocal() |
| final ThreadLocal | threadInterceptor = new ThreadLocal() |
Static Private Attributes | |
| static HibernateUtil | instance |
| static final String | HIBERNATE_FILENAME_KEY = "cdb_rdb.hibernate.cfg.filename" |
Basic Hibernate helper class, handles SessionFactory, Session and Transaction.
Holds Session and Transactions in thread local variables. All exceptions are wrapped in an unchecked HibernateUtilException.
| com::cosylab::cdb::jdal::hibernate::HibernateUtil::HibernateUtil | ( | Logger | logger | ) | [inline, private] |
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::beginTransaction | ( | ) | throws HibernateUtilException [inline] |
Start a new database transaction.
Referenced by alma::acs::tmcdb::TestSnmpTables::createDB(), alma::acs::tmcdb::TestPojosPersistence::createDB(), alma::acs::tmcdb::TestPojosCascading::createDB(), alma::acs::tmcdb::TestSnmpTables::dropDB(), alma::acs::tmcdb::TestPojosPersistence::dropDB(), alma::acs::tmcdb::TestPojosCascading::dropDB(), com::cosylab::cdb::jdal::HibernateWDALImpl::loadXMLCDB(), com::cosylab::cdb::jdal::HibernateWDALImpl::reloadData(), alma::acs::tmcdb::TestPojosCascading::testCascadingAggregation(), alma::acs::tmcdb::TestPojosCascading::testCascadingInverseAggregation(), alma::acs::tmcdb::TestPojosCascading::testCascadingInverseComposition(), alma::acs::tmcdb::TestSnmpTables::testFillSnmpTmcdb(), alma::acs::tmcdb::TestPojosCascading::testNoCascading(), alma::acs::tmcdb::TestPojosPersistence::testSaveInheritance(), alma::acs::tmcdb::TestPojosPersistence::testShutdown(), alma::acs::tmcdb::TestPojosPersistence::testSimpleSave(), and alma::acs::tmcdb::TestPojosPersistence::testXmlTypeSave().
| static void com::cosylab::cdb::jdal::hibernate::HibernateUtil::clearInstance | ( | ) | [inline, static] |
Nulls the instance field, so that subsequent calls to getInstance(Logger) will create a new instance. This probably only makes sense between junit tests that want to start out fresh.
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::closeSession | ( | ) | throws HibernateUtilException [inline] |
Closes the Session local to the thread.
Referenced by com::cosylab::cdb::jdal::HibernateWDALImpl::loadXMLCDB(), com::cosylab::cdb::jdal::HibernateWDALImpl::reloadData(), alma::acs::tmcdb::TestSnmpTables::testFillSnmpTmcdb(), alma::acs::tmcdb::TestPojosCascading::testNoCascading(), alma::acs::tmcdb::TestPojosPersistence::testSimpleSave(), and alma::acs::tmcdb::TestPojosPersistence::testXmlTypeSave().
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::commitTransaction | ( | ) | throws HibernateUtilException [inline] |
Commit the database transaction.
Referenced by alma::acs::tmcdb::TestSnmpTables::createDB(), alma::acs::tmcdb::TestPojosPersistence::createDB(), alma::acs::tmcdb::TestPojosCascading::createDB(), alma::acs::tmcdb::TestSnmpTables::dropDB(), alma::acs::tmcdb::TestPojosPersistence::dropDB(), alma::acs::tmcdb::TestPojosCascading::dropDB(), com::cosylab::cdb::jdal::HibernateWDALImpl::loadXMLCDB(), alma::acs::tmcdb::TestPojosCascading::testCascadingAggregation(), alma::acs::tmcdb::TestPojosCascading::testCascadingInverseAggregation(), alma::acs::tmcdb::TestPojosCascading::testCascadingInverseComposition(), alma::acs::tmcdb::TestSnmpTables::testFillSnmpTmcdb(), alma::acs::tmcdb::TestPojosCascading::testNoCascading(), alma::acs::tmcdb::TestPojosPersistence::testSaveInheritance(), alma::acs::tmcdb::TestPojosPersistence::testShutdown(), alma::acs::tmcdb::TestPojosPersistence::testSimpleSave(), and alma::acs::tmcdb::TestPojosPersistence::testXmlTypeSave().
| Session com::cosylab::cdb::jdal::hibernate::HibernateUtil::disconnectSession | ( | ) | throws HibernateUtilException [inline] |
Disconnect and return Session from current Thread.
| Configuration com::cosylab::cdb::jdal::hibernate::HibernateUtil::getConfiguration | ( | ) | [inline] |
Returns the original Hibernate configuration.
Referenced by alma::acs::tmcdb::TestSnmpTables::createDB(), alma::acs::tmcdb::TestPojosPersistence::createDB(), alma::acs::tmcdb::TestPojosCascading::createDB(), alma::acs::tmcdb::TestSnmpTables::dropDB(), alma::acs::tmcdb::TestPojosPersistence::dropDB(), alma::acs::tmcdb::TestPojosCascading::dropDB(), alma::acs::tmcdb::TestPojosPersistence::testShutdown(), and alma::acs::tmcdb::TestPojosPersistence::testXmlTypeSave().
| final String com::cosylab::cdb::jdal::hibernate::HibernateUtil::getConfigurationFileName | ( | ) | [inline, private] |
| static synchronized HibernateUtil com::cosylab::cdb::jdal::hibernate::HibernateUtil::getInstance | ( | Logger | logger | ) | [inline, static] |
Singleton accessor
Referenced by com::cosylab::cdb::jdal::hibernate::HibernateDBUtil::HibernateDBUtil(), com::cosylab::cdb::jdal::HibernateWDALImpl::HibernateWDALImpl(), alma::acs::tmcdb::TestSnmpTables::setUp(), alma::acs::tmcdb::TestPojosPersistence::setUp(), and alma::acs::tmcdb::TestPojosCascading::setUp().
| Interceptor com::cosylab::cdb::jdal::hibernate::HibernateUtil::getInterceptor | ( | ) | [inline, private] |
| List com::cosylab::cdb::jdal::hibernate::HibernateUtil::getList | ( | Class | type | ) | throws HibernateUtilException [inline] |
Referenced by alma::acs::tmcdb::TestPojosCascading::testCascadingInverseAggregation(), alma::acs::tmcdb::TestPojosCascading::testCascadingInverseComposition(), alma::acs::tmcdb::TestSnmpTables::testFillSnmpTmcdb(), alma::acs::tmcdb::TestPojosPersistence::testSaveInheritance(), and alma::acs::tmcdb::TestPojosPersistence::testXmlTypeSave().
| Session com::cosylab::cdb::jdal::hibernate::HibernateUtil::getSession | ( | ) | throws HibernateUtilException [inline] |
Retrieves the current Session local to the thread.
If no Session is open, opens a new Session for the running thread.
Referenced by alma::acs::tmcdb::TestSnmpTables::createDB(), alma::acs::tmcdb::TestPojosPersistence::createDB(), alma::acs::tmcdb::TestPojosCascading::createDB(), alma::acs::tmcdb::TestSnmpTables::dropDB(), alma::acs::tmcdb::TestPojosPersistence::dropDB(), alma::acs::tmcdb::TestPojosCascading::dropDB(), com::cosylab::cdb::jdal::HibernateWDALImpl::getAlmaBranch(), com::cosylab::cdb::jdal::HibernateWDALImpl::getChannelsTableMap(), com::cosylab::cdb::jdal::HibernateWDALImpl::getComponentsTableMap(), com::cosylab::cdb::jdal::HibernateWDALImpl::getContainersTableMap(), com::cosylab::cdb::jdal::HibernateWDALImpl::initializeRootNode(), com::cosylab::cdb::jdal::HibernateWDALImpl::load(), com::cosylab::cdb::jdal::HibernateWDALImpl::loadXMLCDB(), com::cosylab::cdb::jdal::HibernateWDALImpl::reloadData(), alma::acs::tmcdb::TestPojosCascading::testCascadingAggregation(), alma::acs::tmcdb::TestPojosCascading::testCascadingInverseAggregation(), alma::acs::tmcdb::TestPojosCascading::testCascadingInverseComposition(), alma::acs::tmcdb::TestSnmpTables::testFillSnmpTmcdb(), alma::acs::tmcdb::TestPojosCascading::testNoCascading(), alma::acs::tmcdb::TestPojosPersistence::testSaveInheritance(), alma::acs::tmcdb::TestPojosPersistence::testShutdown(), alma::acs::tmcdb::TestPojosPersistence::testSimpleSave(), and alma::acs::tmcdb::TestPojosPersistence::testXmlTypeSave().
| SessionFactory com::cosylab::cdb::jdal::hibernate::HibernateUtil::getSessionFactory | ( | ) | [inline] |
Returns the SessionFactory used for this static class.
Referenced by com::cosylab::cdb::jdal::HibernateWDALImpl::reloadData(), alma::acs::tmcdb::TestSnmpTables::setUp(), alma::acs::tmcdb::TestPojosPersistence::setUp(), and alma::acs::tmcdb::TestPojosCascading::setUp().
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::rebuildSessionFactory | ( | Configuration | cfg | ) | throws HibernateUtilException [inline] |
Rebuild the SessionFactory with the given Hibernate Configuration.
| cfg |
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::rebuildSessionFactory | ( | ) | throws HibernateUtilException [inline] |
Rebuild the SessionFactory with the static Configuration.
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::reconnect | ( | Session | session | ) | throws HibernateUtilException [inline] |
Reconnects a Hibernate Session to the current Thread.
| session | The Hibernate Session to be reconnected. |
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::registerInterceptor | ( | Interceptor | interceptor | ) | [inline] |
Register a Hibernate interceptor with the current thread.
Every Session opened is opened with this interceptor after registration. Has no effect if the current Session of the thread is already open, effective on next close()/getSession().
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::rollbackTransaction | ( | ) | throws HibernateUtilException [inline] |
Commit the database transaction.
Referenced by alma::acs::tmcdb::TestPojosPersistence::testSimpleSave().
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::setConfiguration | ( | Configuration | config | ) | [inline] |
Set your own configuration and build session factory from it. Used to tests.
| config |
| void com::cosylab::cdb::jdal::hibernate::HibernateUtil::setConfiguration | ( | Properties | extraProperties | ) | [inline] |
Use default configuration and add properties from Properties. Build session factory from combined configuration.
| config |
Referenced by alma::acs::tmcdb::TestSnmpTables::setUp(), alma::acs::tmcdb::TestPojosPersistence::setUp(), alma::acs::tmcdb::TestPojosCascading::setUp(), and com::cosylab::cdb::jdal::hibernate::HibernateDBUtil::setUp().
Configuration com::cosylab::cdb::jdal::hibernate::HibernateUtil::configuration [private] |
final String com::cosylab::cdb::jdal::hibernate::HibernateUtil::HIBERNATE_FILENAME_DEFAULT = "cdb_rdb-hibernate.cfg.xml" [static] |
final String com::cosylab::cdb::jdal::hibernate::HibernateUtil::HIBERNATE_FILENAME_KEY = "cdb_rdb.hibernate.cfg.filename" [static, private] |
HibernateUtil com::cosylab::cdb::jdal::hibernate::HibernateUtil::instance [static, private] |
final Logger com::cosylab::cdb::jdal::hibernate::HibernateUtil::logger [private] |
SessionFactory com::cosylab::cdb::jdal::hibernate::HibernateUtil::sessionFactory [private] |
final ThreadLocal com::cosylab::cdb::jdal::hibernate::HibernateUtil::threadInterceptor = new ThreadLocal() [private] |
final ThreadLocal com::cosylab::cdb::jdal::hibernate::HibernateUtil::threadSession = new ThreadLocal() [private] |
final ThreadLocal com::cosylab::cdb::jdal::hibernate::HibernateUtil::threadTransaction = new ThreadLocal() [private] |
1.6.2