net.sf.shineframework.server.dal.dao
Class BaseNamedDao<T extends DalObject>

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.jpa.support.JpaDaoSupport
          extended by net.sf.shineframework.server.dal.dao.BaseDao<T>
              extended by net.sf.shineframework.server.dal.dao.BaseNamedDao<T>
All Implemented Interfaces:
Dao<T>, NamedDao<T>, org.springframework.beans.factory.InitializingBean

public class BaseNamedDao<T extends DalObject>
extends BaseDao<T>
implements NamedDao<T>

Author:
amirk

Field Summary
 
Fields inherited from class net.sf.shineframework.server.dal.dao.BaseDao
logger, managedClass, shortName
 
Constructor Summary
BaseNamedDao()
           
 
Method Summary
 java.util.Collection<T> getAllOrdered()
          retrieves all objects ordered by name.
 java.util.Collection<T> getByName(java.lang.String name)
          retrieves objects from the database by thier name
 T getUniqueByName(java.lang.String name)
          retrieves a unique instance of the object in the database
 java.util.Collection<T> matchByName(java.lang.String name)
          retrieves objects from the database based on their name with the "like" operator
 
Methods inherited from class net.sf.shineframework.server.dal.dao.BaseDao
delete, find, find, find, find, findByNamedParam, findByNamedParam, findByNamedQuery, findByNamedQuery, findByNamedQuery, findByNamedQuery, findByProperties, getAll, getAllObjects, getByBusinessKey, getByPk, getByProperties, getByUniqueProperties, getManagedClass, isNamedQuery, load, load, load, load, merge, save, setManagedClass, setManagedClassName
 
Methods inherited from class org.springframework.orm.jpa.support.JpaDaoSupport
checkDaoConfig, createJpaTemplate, createJpaTemplate, getJpaTemplate, setEntityManager, setEntityManagerFactory, setJpaTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.shineframework.server.dal.dao.Dao
delete, getAll, getByBusinessKey, getByPk, getByProperties, getByUniqueProperties, merge, save
 

Constructor Detail

BaseNamedDao

public BaseNamedDao()
Method Detail

getAllOrdered

public java.util.Collection<T> getAllOrdered()
                                                        throws org.springframework.dao.DataAccessException
retrieves all objects ordered by name. This method attempt to locate a ManagedClass.allOrderedByName query in your managed class (for example: Employee.allOrderedByName). This allows you to override the default query that executes ("from ManagedClass").
This is highly useful when trying to use the retrieved objects out of the transaction scope.

Specified by:
getAllOrdered in interface NamedDao<T extends DalObject>
Returns:
all objects
Throws:
org.springframework.dao.DataAccessException

getByName

public java.util.Collection<T> getByName(java.lang.String name)
                                                    throws org.springframework.dao.DataAccessException
Description copied from interface: NamedDao
retrieves objects from the database by thier name

Specified by:
getByName in interface NamedDao<T extends DalObject>
Parameters:
name - object name
Returns:
the objects (or null when no match found)
Throws:
org.springframework.dao.DataAccessException

matchByName

public java.util.Collection<T> matchByName(java.lang.String name)
                                                      throws org.springframework.dao.DataAccessException
Description copied from interface: NamedDao
retrieves objects from the database based on their name with the "like" operator

Specified by:
matchByName in interface NamedDao<T extends DalObject>
Parameters:
name - object name
Returns:
the objects (or null when no match found)
Throws:
org.springframework.dao.DataAccessException

getUniqueByName

public T getUniqueByName(java.lang.String name)
                                    throws org.springframework.dao.DataAccessException
Description copied from interface: NamedDao
retrieves a unique instance of the object in the database

Specified by:
getUniqueByName in interface NamedDao<T extends DalObject>
Parameters:
name - object name
Returns:
the object (or null when no match found)
Throws:
org.springframework.dao.DataAccessException - when there's an error and where the result is non-unique


Copyright © 2007 sourceforge.net. All Rights Reserved.