net.sf.shineframework.server.dal.dao
Interface Dao<T extends DalObject>

All Known Subinterfaces:
FwDao<T>, NamedDao<T>
All Known Implementing Classes:
BaseDao, BaseFwDao, BaseNamedDao

public interface Dao<T extends DalObject>

Author:
amirk

Method Summary
 void delete(T o)
          deletes an object from the database
 java.util.Collection<T> getAll()
          retrieves all objects of the managed type from the database
 T getByBusinessKey(T dm)
          retrieves an object that matches the business key properties in the dm.
 T getByPk(java.io.Serializable pk)
          retrieves an object from the database by its primary key
 java.util.Collection<T> getByProperties(T dm, java.lang.Object... names)
          retrieves all objects that match the properties.
 T getByUniqueProperties(T dm)
          retrieves an object that matches the unique properties of the provided dm.
 T merge(T o)
          merges an object to the database.
 T save(T o)
          saves an object to the database
 

Method Detail

delete

void delete(T o)
deletes an object from the database

Parameters:
o - DalObject to delete

getAll

java.util.Collection<T> getAll()
retrieves all objects of the managed type from the database

Returns:
all objects of the managed type from the database

getByPk

T getByPk(java.io.Serializable pk)
                            throws org.springframework.dao.DataAccessException
retrieves an object from the database by its primary key

Parameters:
pk - primary key
Returns:
the object (or null when no match found)
Throws:
org.springframework.dao.DataAccessException

getByProperties

java.util.Collection<T> getByProperties(T dm,
                                        java.lang.Object... names)
retrieves all objects that match the properties. Use the dm as an "example" object on which properties named names are being considered in the query

Parameters:
dm - example domain object
names - property named to fetch by
Returns:
all objects that match the properties in the example domain object

getByUniqueProperties

T getByUniqueProperties(T dm)
retrieves an object that matches the unique properties of the provided dm. The unique properties are defined by the Column(unique=true) persistence annotation.

Parameters:
dm - example domain object
Returns:
an object that matches the unique criteria in the example dm

getByBusinessKey

T getByBusinessKey(T dm)
retrieves an object that matches the business key properties in the dm. The business key properties are determined by the BusinessKey annotation.

Parameters:
dm - example domain object
Returns:
an object that matches the business key criteria in the example dm

save

T save(T o)
saves an object to the database

Parameters:
o - DalObject to save
Returns:
the saved object (with a freshly-created primary key)

merge

T merge(T o)
merges an object to the database. Use this method to update objects

Parameters:
o - DalObject to merge
Returns:
the merged object (attached to the session)


Copyright © 2007 sourceforge.net. All Rights Reserved.