|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.softslate.commerce.daos.core.BaseDAO
public abstract class BaseDAO
Abstract superclass for all objects in the data access layer.
The methods provided allow implementations to communicate with other elements
of the application. In particular, retrieve settings (using
getSettings()), retrieve database connections (using
getConnection()), retrieve SQL statements (using
getSqlMap() and getSQL(java.lang.String, java.lang.String)), and create other data
access objects (using getDaoFactory()).
| Field Summary | |
|---|---|
private java.util.Properties |
appComponents
|
private java.util.Properties |
appSettings
|
private java.sql.Connection |
connection
|
private DAOFactory |
daoFactory
|
private DAOUtils |
daoUtils
|
private javax.sql.DataSource |
dataSource
|
private java.util.Map |
importExportSqlMap
|
(package private) static org.apache.commons.logging.Log |
log
|
private Settings |
settings
|
private java.util.Map |
sqlMap
|
| Constructor Summary | |
|---|---|
BaseDAO()
|
|
| Method Summary | |
|---|---|
boolean |
deleteObject(java.lang.Object object,
boolean commit)
|
void |
evictCache()
|
java.lang.String |
formatDateTime(java.util.Date dateTime)
Formats a Date object into a string suitable for storage in the database. |
java.util.Properties |
getAppComponents()
Retrieves this factory's component settings. |
java.util.Properties |
getAppSettings()
Retrieves this factory's application settings. |
java.sql.Connection |
getConnection()
Retrieves a Connection to the application's
DataSource. |
DAOFactory |
getDaoFactory()
Retrieves the application's DAOFactory. |
DAOUtils |
getDAOUtils()
Retrieves a utility object that provides useful methods for daos. |
javax.sql.DataSource |
getDataSource()
Retrieves the application's DataSource. |
java.lang.String |
getImportExportSQL(java.lang.String module,
java.lang.String key)
Returns an SQL statement configured in the .properties files under "/WEB-INF/classes/resources/importexport". |
java.util.Map |
getImportExportSqlMap()
|
org.hibernate.Query |
getNamedQuery(org.hibernate.Session session,
java.lang.String queryName)
Returns a custom named query with the "-custom" suffix if one exists, otherwise returns the normally named query. |
Settings |
getSettings()
Retrieves the Settings previously set for this data access
object. |
java.lang.String |
getSQL(java.lang.String module,
java.lang.String key)
Legacy method that returns an SQL statement configured in the .properties files under "/WEB-INF/classes/resources". |
java.util.Map |
getSqlMap()
Retrieves a Map of the SQL statements used by the
application. |
void |
initialize(java.util.Map transferMap)
Initializes this data access object by copying incoming parameters into its properties. |
java.lang.Object |
insertObject(java.lang.Object object,
boolean commit)
|
java.util.Collection |
loadAll()
|
java.util.Collection |
loadAll(org.hibernate.Filter filter)
|
java.lang.Object |
loadObject(java.lang.Object object)
|
java.util.Date |
parseDateTime(java.lang.String dateTime)
Formats a Date object into a string suitable for storage in the database. |
void |
setAppComponents(java.util.Properties appComponents)
|
void |
setAppSettings(java.util.Properties appSettings)
|
void |
setConnection(java.sql.Connection connection)
|
void |
setDaoFactory(DAOFactory daoFactory)
|
void |
setDAOUtils(DAOUtils daoUtils)
|
void |
setDataSource(javax.sql.DataSource dataSource)
|
void |
setImportExportSqlMap(java.util.Map importExportSqlMap)
|
void |
setSettings(Settings settings)
|
void |
setSqlMap(java.util.Map sqlMap)
|
java.lang.Object |
updateObject(java.lang.Object object,
boolean commit)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static org.apache.commons.logging.Log log
private Settings settings
private java.util.Properties appSettings
private java.util.Properties appComponents
private javax.sql.DataSource dataSource
private java.sql.Connection connection
private java.util.Map sqlMap
private java.util.Map importExportSqlMap
private DAOFactory daoFactory
private DAOUtils daoUtils
| Constructor Detail |
|---|
public BaseDAO()
| Method Detail |
|---|
public Settings getSettings()
DAOInterfaceSettings previously set for this data access
object.
getSettings in interface DAOInterfaceSettings object that represents various settings
for the system.public void setSettings(Settings settings)
setSettings in interface DAOInterfacepublic java.util.Properties getAppSettings()
DAOInterfaceSettingsBean, which
stores settings drawn from the database.
getAppSettings in interface DAOInterfacepublic void setAppSettings(java.util.Properties appSettings)
setAppSettings in interface DAOInterfacepublic java.util.Properties getAppComponents()
DAOInterface
getAppComponents in interface DAOInterfacepublic void setAppComponents(java.util.Properties appComponents)
setAppComponents in interface DAOInterfacepublic javax.sql.DataSource getDataSource()
DAOInterfaceDataSource.
getDataSource in interface DAOInterfaceDataSource.public void setDataSource(javax.sql.DataSource dataSource)
setDataSource in interface DAOInterfacepublic java.sql.Connection getConnection()
DAOInterfaceConnection to the application's
DataSource.
getConnection in interface DAOInterfaceConnection to the application's
DataSource.public void setConnection(java.sql.Connection connection)
setConnection in interface DAOInterfacepublic java.util.Map getSqlMap()
DAOInterfaceMap of the SQL statements used by the
application.
getSqlMap in interface DAOInterfaceMap of the SQL statements used by the
application.public void setSqlMap(java.util.Map sqlMap)
setSqlMap in interface DAOInterfacepublic java.util.Map getImportExportSqlMap()
public void setImportExportSqlMap(java.util.Map importExportSqlMap)
public DAOFactory getDaoFactory()
DAOInterfaceDAOFactory.
getDaoFactory in interface DAOInterfaceDAOFactory.public void setDaoFactory(DAOFactory daoFactory)
setDaoFactory in interface DAOInterface
public void initialize(java.util.Map transferMap)
throws java.lang.Exception
DAOInterfaceDAOFactory after object
creation to copy the application's
DAOFactory and
Settings
into the new object. The sqlMap and
dataSource properties are also copied from the
DAOFactory.
initialize in interface DAOInterfacetransferMap - A Map containing objects such as the
application's DAOFactory and
Settings.
java.lang.Exception
public java.lang.String getSQL(java.lang.String module,
java.lang.String key)
throws java.lang.Exception
module - The application module corresponding to the desired SQL
statement, such as "core", "product", "order", or "customer".key - A string key for the SQL statement corresponding to the keys
in the .properties files.
null if the requested
statement could not be found.
java.lang.Exception
public java.lang.String getImportExportSQL(java.lang.String module,
java.lang.String key)
throws java.lang.Exception
module - The application module corresponding to the desired SQL
statement. Must be "importexport".key - A string key for the SQL statement corresponding to the keys
in the .properties files.
null if the requested
statement could not be found.
java.lang.Exceptionpublic java.lang.String formatDateTime(java.util.Date dateTime)
dateTime -
public java.util.Date parseDateTime(java.lang.String dateTime)
throws java.lang.Exception
dateTime -
java.lang.Exceptionpublic DAOUtils getDAOUtils()
DAOInterface
getDAOUtils in interface DAOInterfacepublic void setDAOUtils(DAOUtils daoUtils)
setDAOUtils in interface DAOInterface
public org.hibernate.Query getNamedQuery(org.hibernate.Session session,
java.lang.String queryName)
throws org.hibernate.HibernateException
Named queries can be overridden by creating a new query in one of the
queries-custom.hbm.xml files. The new query must have the
same name as the query it's replacing, but with "-custom" appended to the
name. This method looks to see if a custom query exists before returning
the regular query.
session - The current Hibernate session.queryName - The name of the query to return (without the "-custom"
suffix).
org.hibernate.HibernateExceptionpublic void evictCache()
public java.lang.Object loadObject(java.lang.Object object)
throws java.lang.Exception
loadObject in interface DAOInterfacejava.lang.Exception
public java.lang.Object updateObject(java.lang.Object object,
boolean commit)
throws java.lang.Exception
updateObject in interface DAOInterfacejava.lang.Exception
public boolean deleteObject(java.lang.Object object,
boolean commit)
throws java.lang.Exception
deleteObject in interface DAOInterfacejava.lang.Exception
public java.lang.Object insertObject(java.lang.Object object,
boolean commit)
throws java.lang.Exception
insertObject in interface DAOInterfacejava.lang.Exception
public java.util.Collection loadAll()
throws java.lang.Exception
loadAll in interface DAOInterfacejava.lang.Exception
public java.util.Collection loadAll(org.hibernate.Filter filter)
throws java.lang.Exception
loadAll in interface DAOInterfacejava.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||