|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.geekologue.md4j.dao.AbstractDAO
com.geekologue.md4j.dao.hibernate.AbstractHbmDAO
public abstract class AbstractHbmDAO
Hibernate based DAO
Field Summary | |
---|---|
protected org.hibernate.SessionFactory |
sf
|
Fields inherited from class com.geekologue.md4j.dao.AbstractDAO |
---|
daoClass, identifierName |
Constructor Summary | |
---|---|
AbstractHbmDAO(java.lang.Class clazz,
java.lang.String idName)
|
Method Summary | |
---|---|
abstract void |
addParentOptions(java.util.Map map)
|
abstract void |
copyProperties(java.util.Map from,
java.lang.Object to)
Copy the properties from the given Map to the target POJO object, converting the value type where appropriate. |
protected java.lang.Object |
createFromParams(java.util.Map map)
|
void |
delete(java.io.Serializable pojo)
Delete the object coresponding to the given identifier |
boolean |
exists(java.lang.String name,
java.io.Serializable value,
java.io.Serializable id)
Checks whether a persisted instance exists with the given property/value pair. |
protected java.util.List |
findByExample(java.lang.Object exampleObject)
|
java.lang.Object |
get(java.io.Serializable identifier)
Retreive the object matching the class handled by this DAO and the given identifier or null if no match is found. |
java.util.Map |
get(java.io.Serializable identifier,
java.util.Set projectionProperties)
Retreive the properties of the object matching the given identifier as a Map of attribute-value pairs. |
java.util.Set |
getBrokenUConstraints(java.util.Map params,
java.io.Serializable id)
Get unique constraint violations before persisting new objects |
Page |
getPage(java.util.Map params,
Order order,
int pageNumber,
int pageSize)
Get a page of results. |
Page |
getPage(java.util.Set projectionProps,
java.util.Map params,
Order order,
int pageNumber,
int pageSize)
Get a page of results. |
protected Page |
getPage(java.util.Set projectionProps,
Order order,
org.hibernate.Criteria criteria,
int pageNumber,
int pageSize)
Create and return a Page of results. |
java.util.Map |
getParentOptions()
Get data to populate drop downs refering to parent objects by many-to-one relationships. |
abstract java.util.Set |
getUniquePropertyNames()
Get the property names for which unique constraints exis |
java.util.List |
listAll()
|
java.lang.Object |
load(java.io.Serializable identifier)
Retreive the object matching the class handled by this DAO and the given identifier. |
protected abstract void |
populateCriteria(java.util.Set projectionProps,
java.util.Map params,
org.hibernate.Criteria criteria)
|
java.io.Serializable |
save(java.lang.Object pojo)
Save the given object |
java.io.Serializable |
saveOrUpdate(java.lang.Object pojo)
|
void |
update(java.util.Map map)
Update the object matching the given identifier according to the property value pairs in the given map. |
void |
update(java.lang.Object pojo)
Persist any changes to the given POJO |
protected java.lang.Object |
updateFromParams(java.util.Map map)
Subclasses must override this method to obtain the persisted instance from here and update properties in their implementation of the method |
Methods inherited from class com.geekologue.md4j.dao.AbstractDAO |
---|
getDaoClassInstance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.hibernate.SessionFactory sf
Constructor Detail |
---|
public AbstractHbmDAO(java.lang.Class clazz, java.lang.String idName)
clazz
- Method Detail |
---|
public java.lang.Object load(java.io.Serializable identifier) throws DataAccessException
load
in class AbstractDAO
identifier
-
DataAccessException
AbstractDAO.get(java.io.Serializable)
public java.lang.Object get(java.io.Serializable identifier) throws DataAccessException
get
in class AbstractDAO
identifier
-
null
otherwise
DataAccessException
AbstractDAO.get(java.io.Serializable)
public java.util.Map get(java.io.Serializable identifier, java.util.Set projectionProperties)
identifier
- projectionProperties
- the names of properties to retrieve
null
otherwise.com.geekologue.md4j.dao.AbstractDAO#get(Serializable, Set)
public void update(java.util.Map map) throws DataAccessException
null
update
in class AbstractDAO
map
- the map with the property value pairs to update
DataAccessException
com.geekologue.md4j.dao.AbstractDAO#update(java.util.Map,
java.io.Serializable)
public void update(java.lang.Object pojo) throws DataAccessException
AbstractDAO
update
in class AbstractDAO
pojo
- the POJO to update
DataAccessException
com.geekologue.md4j.dao.AbstractDAO#update(java.util.Map,
java.io.Serializable)
public java.util.List listAll() throws DataAccessException
DataAccessException
com.geekologue.md4j.dao.AbstractDAO#listAll()
public java.io.Serializable save(java.lang.Object pojo) throws DataAccessException
AbstractDAO
save
in class AbstractDAO
pojo
- the POJO to save
DataAccessException
AbstractDAO.save(java.lang.Object)
public java.io.Serializable saveOrUpdate(java.lang.Object pojo) throws DataAccessException
DataAccessException
com.geekologue.md4j.dao.AbstractDAO#saveOrUpdate(java.lang.Object)
protected java.util.List findByExample(java.lang.Object exampleObject) throws DataAccessException
DataAccessException
com.geekologue.md4j.dao.AbstractDAO#findByExample(java.lang.Object)
public Page getPage(java.util.Map params, Order order, int pageNumber, int pageSize)
AbstractDAO
getPage
in class AbstractDAO
params
- the attribute-value pairs the results have to matchpageNumber
- the number of the pagepageSize
- the number of results in the page
AbstractDAO.getPage(Map, Order, int, int)
public Page getPage(java.util.Set projectionProps, java.util.Map params, Order order, int pageNumber, int pageSize)
AbstractDAO
getPage
in class AbstractDAO
projectionProps
- the names of the property values to returnparams
- the attribute-value pairs the results have to matchpageNumber
- the number of the pagepageSize
- the number of results in the page
AbstractDAO.getPage(Set, Map, Order, int,
int)
protected abstract void populateCriteria(java.util.Set projectionProps, java.util.Map params, org.hibernate.Criteria criteria)
protected Page getPage(java.util.Set projectionProps, Order order, org.hibernate.Criteria criteria, int pageNumber, int pageSize)
sess
- The Hibernate Session object to use for the searchprojectionProps
- The set of properties to return for each resultparams
- The set of search criteria to usecriteria
- The criteria to use for the search, produced by each DAO in
the object hierarchy using the params
mappageNumber
- The page number to returnpageSize
- The page size
public void delete(java.io.Serializable pojo) throws DataAccessException
AbstractDAO
delete
in class AbstractDAO
DataAccessException
protected java.lang.Object createFromParams(java.util.Map map)
protected java.lang.Object updateFromParams(java.util.Map map)
map
-
DataAccessException
public boolean exists(java.lang.String name, java.io.Serializable value, java.io.Serializable id)
name
- the name of the propertyvalue
- the value to look forid
- the record to exclude from the search, usefull for checking
constraints in case of an update (null
may be
provided)
public java.util.Set getBrokenUConstraints(java.util.Map params, java.io.Serializable id)
AbstractDAO
getBrokenUConstraints
in class AbstractDAO
params
- the property value pairs to check
public abstract void copyProperties(java.util.Map from, java.lang.Object to)
from
- to
- public abstract java.util.Set getUniquePropertyNames()
public java.util.Map getParentOptions()
getParentOptions
in class AbstractDAO
AbstractDAO.getParentOptions()
public abstract void addParentOptions(java.util.Map map)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |