|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.softslate.commerce.daos.core.BaseDAOFactory
com.softslate.commerce.daos.core.HibernateDAOFactory
public class HibernateDAOFactory
Factory class used to create and initialize instances of Hibernate data access objects.
An instance of HDAOFactory is created in the Struts layer and
placed in the application scope. (See
BaseRequestProcessor.)
Immediately after instantiating the requested DAO, this factory passes its own properties to it so that the newly created object can use them to communicate with the rest of the application.
| Field Summary | |
|---|---|
private java.util.Properties |
appComponents
|
private java.util.Properties |
appComponentsDefaults
|
private java.util.Properties |
appSettings
|
private java.util.Map |
importExportSqlMap
|
(package private) static org.apache.commons.logging.Log |
log
|
private org.hibernate.SessionFactory |
sessionFactory
|
private Settings |
settings
|
private static java.lang.ThreadLocal |
threadSession
|
private static java.lang.ThreadLocal |
threadTransaction
|
| Fields inherited from class com.softslate.commerce.daos.core.BaseDAOFactory |
|---|
moduleListString |
| Constructor Summary | |
|---|---|
HibernateDAOFactory()
|
|
| Method Summary | |
|---|---|
void |
addComponentMappings(org.hibernate.cfg.Configuration configuration,
java.util.Properties components)
|
void |
beginTransaction()
Start a new database transaction. |
void |
closeSession()
Closes the Session local to the thread. |
void |
commitTransaction()
Commit the database transaction. |
java.lang.Object |
createDAO(java.lang.String type)
Creates and initializes a data access object for use by the application. |
void |
evictCache()
Evicts the Hibernate 2nd level cache, plus any cached queries. |
java.util.Properties |
getAppComponents()
Retrieves this factory's component settings. |
java.util.Properties |
getAppComponentsDefaults()
Retrieves this factory's default component settings. |
java.util.Properties |
getAppSettings()
Retrieves this factory's application settings; the current application settings for the system. |
java.lang.String |
getDatabaseType()
|
java.util.Map |
getImportExportSqlMap()
|
org.hibernate.Session |
getSession()
Retrieves the current Session local to the thread. |
org.hibernate.SessionFactory |
getSessionFactory()
Retrieves this factory's Hibernate SessionFactory. |
Settings |
getSettings()
Retrieves this factory's Settings instance. |
java.util.Map |
getTransferMap()
Retrieves a Map of properties that will be transfered to
each of the data access objects this factory creates. |
void |
initialize()
Initializes this DAOFactory. |
org.hibernate.cfg.Configuration |
initializeSessionFactory()
Creates a configured instance of Hibernate's SessionFactory
in the application scope. |
void |
rollbackTransaction()
Rollback the database transaction. |
void |
rollbackTransactionKeepingSessionOpen()
Rollback the database transaction. |
void |
setAppComponents(java.util.Properties appComponents)
|
void |
setAppComponentsDefaults(java.util.Properties appComponentsDefaults)
|
void |
setAppSettings(java.util.Properties appSettings)
|
void |
setImportExportSqlMap(java.util.Map importExportSqlMap)
|
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
|
void |
setSettings(Settings settings)
|
org.hibernate.Session |
startSession()
Starts an interaction with Hibernate. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.softslate.commerce.daos.core.DAOFactory |
|---|
createDAOFromClassName, getHibernateSettings, getJndiDataSource, setDatabaseType, setHibernateSettings |
| Field Detail |
|---|
static org.apache.commons.logging.Log log
private static final java.lang.ThreadLocal threadSession
private static final java.lang.ThreadLocal threadTransaction
private Settings settings
private java.util.Properties appSettings
private java.util.Properties appComponents
private java.util.Properties appComponentsDefaults
private org.hibernate.SessionFactory sessionFactory
private java.util.Map importExportSqlMap
| Constructor Detail |
|---|
public HibernateDAOFactory()
| Method Detail |
|---|
public Settings getSettings()
DAOFactorySettings instance. The current
Settings, containing various settings to be used by DAOs
created by this factory. This factory will pass the Settings
to every object it creates.
getSettings in interface DAOFactorygetSettings in class BaseDAOFactorypublic void setSettings(Settings settings)
setSettings in interface DAOFactorysetSettings in class BaseDAOFactorypublic java.util.Properties getAppSettings()
DAOFactorySettings instance, which
stores settings drawn from the database.
getAppSettings in interface DAOFactorygetAppSettings in class BaseDAOFactorypublic void setAppSettings(java.util.Properties appSettings)
setAppSettings in interface DAOFactorysetAppSettings in class BaseDAOFactorypublic java.util.Properties getAppComponents()
DAOFactory
getAppComponents in interface DAOFactorygetAppComponents in class BaseDAOFactorypublic void setAppComponents(java.util.Properties appComponents)
setAppComponents in interface DAOFactorysetAppComponents in class BaseDAOFactorypublic java.util.Properties getAppComponentsDefaults()
DAOFactory
getAppComponentsDefaults in interface DAOFactorygetAppComponentsDefaults in class BaseDAOFactorypublic void setAppComponentsDefaults(java.util.Properties appComponentsDefaults)
setAppComponentsDefaults in interface DAOFactorysetAppComponentsDefaults in class BaseDAOFactorypublic org.hibernate.SessionFactory getSessionFactory()
DAOFactorySessionFactory.
getSessionFactory in interface DAOFactorygetSessionFactory in class BaseDAOFactorypublic void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
setSessionFactory in interface DAOFactorysetSessionFactory in class BaseDAOFactorypublic java.util.Map getImportExportSqlMap()
public void setImportExportSqlMap(java.util.Map importExportSqlMap)
public void initialize()
throws java.lang.Exception
BaseDAOFactoryDAOFactory. Called by
BaseRequestProcessor.
initialize in interface DAOFactoryinitialize in class BaseDAOFactoryjava.lang.Exceptionpublic org.hibernate.cfg.Configuration initializeSessionFactory()
SessionFactory
in the application scope.
public void addComponentMappings(org.hibernate.cfg.Configuration configuration,
java.util.Properties components)
public java.lang.Object createDAO(java.lang.String type)
throws java.lang.Exception
appComponents property.
createDAO in interface DAOFactorycreateDAO in class BaseDAOFactorytype - A String associated with the class name of the
data access object to be created.
null if initialization failed.
java.lang.Exceptionpublic java.util.Map getTransferMap()
Map of properties that will be transfered to
each of the data access objects this factory creates.
getTransferMap in class BaseDAOFactoryMap of properties that will be transfered to
each of the data access objects this factory createspublic org.hibernate.Session startSession()
startSession in interface DAOFactorystartSession in class BaseDAOFactorypublic org.hibernate.Session getSession()
getSession in interface DAOFactorygetSession in class BaseDAOFactorypublic void closeSession()
closeSession in interface DAOFactorycloseSession in class BaseDAOFactorypublic void beginTransaction()
beginTransaction in interface DAOFactorybeginTransaction in class BaseDAOFactory
public void commitTransaction()
throws org.hibernate.HibernateException
commitTransaction in interface DAOFactorycommitTransaction in class BaseDAOFactoryorg.hibernate.HibernateExceptionpublic void rollbackTransactionKeepingSessionOpen()
rollbackTransactionKeepingSessionOpen in interface DAOFactoryrollbackTransactionKeepingSessionOpen in class BaseDAOFactorypublic void rollbackTransaction()
rollbackTransaction in interface DAOFactoryrollbackTransaction in class BaseDAOFactorypublic java.lang.String getDatabaseType()
getDatabaseType in interface DAOFactorygetDatabaseType in class BaseDAOFactorypublic void evictCache()
getSessionFactory().evict(String region), and then
runs getSessionFactory().evictQueries(); to evicted cached
queries.
evictCache in interface DAOFactoryevictCache in class BaseDAOFactory
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||