Anyframe Core

anyframe.core.basis.dao.query
Class GenericDaoQuery<T,PK extends Serializable>

java.lang.Object
  extended by anyframe.core.query.AbstractDAO
      extended by anyframe.core.basis.dao.query.GenericDaoQuery<T,PK>
Type Parameters:
T - a type variable
PK - the primary key for that type
All Implemented Interfaces:
GenericDao<T,PK>

public class GenericDaoQuery<T,PK extends Serializable>
extends AbstractDAO
implements GenericDao<T,PK>

This class serves as the Base class for all other DAOs - namely to hold common CRUD methods that they might all use. You should only need to extend this class when your require custom CRUD logic.

Author:
Bryan Noll, modified by SooYeon Park

Field Summary
protected  Log log
          Log variable for all child classes.
 
Constructor Summary
GenericDaoQuery(Class<T> persistentClass)
          Constructor that takes in a class to see which type of entity to persist.
 
Method Summary
 boolean exists(PK id)
          Checks for existence of an object of type T using the id arg.
 T get(PK id)
          Generic method to get an object based on class and identifier.
 Page getList(SearchVO searchVO)
          Generic method to get object list based on search condition and search keyword
 Class<T> getPersistentClass()
           
 IPropertiesService getPropertiesService()
           
 void remove(PK id)
          Generic method to delete an object based on class and id
 T save(T object)
          Generic method to save an object - handles both update and insert.
 void setPropertiesService(IPropertiesService propertiesService)
          Sets the propertiesService to use.
 
Methods inherited from class anyframe.core.query.AbstractDAO
create, create, create, create, create, findByPk, findByPk, findByPk, findByPk, findList, findList, findList, findList, findList, findList, findList, findListWithPaging, findListWithPaging, findListWithPaging, findListWithPaging, findListWithPaging, findListWithPaging, findListWithPaging, findListWithPaging, getQueryService, remove, remove, remove, remove, remove, setCreateId, setFindByPkPostfix, setFindListPostfix, setFindPrefix, setQueryService, setRemoveId, setUpdateId, setVariableName, update, update, update, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final Log log
Log variable for all child classes. Uses LogFactory.getLog(getClass()) from Commons Logging

Constructor Detail

GenericDaoQuery

public GenericDaoQuery(Class<T> persistentClass)
Constructor that takes in a class to see which type of entity to persist. Use this constructor when subclassing or using dependency injection.

Parameters:
persistentClass - the class type you'd like to persist
Method Detail

getPersistentClass

public Class<T> getPersistentClass()

getPropertiesService

public IPropertiesService getPropertiesService()

setPropertiesService

public void setPropertiesService(IPropertiesService propertiesService)
Sets the propertiesService to use.

Parameters:
propertiesService - The propertiesService to set

get

public T get(PK id)
      throws Exception
Generic method to get an object based on class and identifier. An ObjectRetrievalFailureException Runtime Exception is thrown if nothing is found.

Specified by:
get in interface GenericDao<T,PK extends Serializable>
Parameters:
id - the identifier (primary key) of the object to get
Returns:
a populated object
Throws:
Exception
See Also:
ObjectRetrievalFailureException

exists

public boolean exists(PK id)
               throws Exception
Checks for existence of an object of type T using the id arg.

Specified by:
exists in interface GenericDao<T,PK extends Serializable>
Parameters:
id - the id of the entity
Returns:
- true if it exists, false if it doesn't
Throws:
Exception

save

public T save(T object)
       throws Exception
Generic method to save an object - handles both update and insert.

Specified by:
save in interface GenericDao<T,PK extends Serializable>
Parameters:
object - the object to save
Returns:
the persisted object
Throws:
Exception

remove

public void remove(PK id)
            throws Exception
Generic method to delete an object based on class and id

Specified by:
remove in interface GenericDao<T,PK extends Serializable>
Parameters:
id - the identifier (primary key) of the object to remove
Throws:
Exception

getList

public Page getList(SearchVO searchVO)
             throws Exception
Description copied from interface: GenericDao
Generic method to get object list based on search condition and search keyword

Specified by:
getList in interface GenericDao<T,PK extends Serializable>
Parameters:
searchVO - search condition and search keyword
Throws:
Exception

Anyframe Core

Copyright © 2008-2009 Samsung SDS. All Rights Reserved.