|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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 |
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()
DAOFactory
Settings
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 DAOFactory
getSettings
in class BaseDAOFactory
public void setSettings(Settings settings)
setSettings
in interface DAOFactory
setSettings
in class BaseDAOFactory
public java.util.Properties getAppSettings()
DAOFactory
Settings
instance, which
stores settings drawn from the database.
getAppSettings
in interface DAOFactory
getAppSettings
in class BaseDAOFactory
public void setAppSettings(java.util.Properties appSettings)
setAppSettings
in interface DAOFactory
setAppSettings
in class BaseDAOFactory
public java.util.Properties getAppComponents()
DAOFactory
getAppComponents
in interface DAOFactory
getAppComponents
in class BaseDAOFactory
public void setAppComponents(java.util.Properties appComponents)
setAppComponents
in interface DAOFactory
setAppComponents
in class BaseDAOFactory
public java.util.Properties getAppComponentsDefaults()
DAOFactory
getAppComponentsDefaults
in interface DAOFactory
getAppComponentsDefaults
in class BaseDAOFactory
public void setAppComponentsDefaults(java.util.Properties appComponentsDefaults)
setAppComponentsDefaults
in interface DAOFactory
setAppComponentsDefaults
in class BaseDAOFactory
public org.hibernate.SessionFactory getSessionFactory()
DAOFactory
SessionFactory
.
getSessionFactory
in interface DAOFactory
getSessionFactory
in class BaseDAOFactory
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
setSessionFactory
in interface DAOFactory
setSessionFactory
in class BaseDAOFactory
public java.util.Map getImportExportSqlMap()
public void setImportExportSqlMap(java.util.Map importExportSqlMap)
public void initialize() throws java.lang.Exception
BaseDAOFactory
DAOFactory
. Called by
BaseRequestProcessor
.
initialize
in interface DAOFactory
initialize
in class BaseDAOFactory
java.lang.Exception
public 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 DAOFactory
createDAO
in class BaseDAOFactory
type
- A String
associated with the class name of the
data access object to be created.
null
if initialization failed.
java.lang.Exception
public java.util.Map getTransferMap()
Map
of properties that will be transfered to
each of the data access objects this factory creates.
getTransferMap
in class BaseDAOFactory
Map
of properties that will be transfered to
each of the data access objects this factory createspublic org.hibernate.Session startSession()
startSession
in interface DAOFactory
startSession
in class BaseDAOFactory
public org.hibernate.Session getSession()
getSession
in interface DAOFactory
getSession
in class BaseDAOFactory
public void closeSession()
closeSession
in interface DAOFactory
closeSession
in class BaseDAOFactory
public void beginTransaction()
beginTransaction
in interface DAOFactory
beginTransaction
in class BaseDAOFactory
public void commitTransaction() throws org.hibernate.exception.ConstraintViolationException
commitTransaction
in interface DAOFactory
commitTransaction
in class BaseDAOFactory
org.hibernate.exception.ConstraintViolationException
public void rollbackTransaction()
rollbackTransaction
in interface DAOFactory
rollbackTransaction
in class BaseDAOFactory
public java.lang.String getDatabaseType()
getDatabaseType
in interface DAOFactory
getDatabaseType
in class BaseDAOFactory
public void evictCache()
getSessionFactory().evict(String region)
, and then
runs getSessionFactory().evictQueries();
to evicted cached
queries.
evictCache
in interface DAOFactory
evictCache
in class BaseDAOFactory
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |