/**
*
* @ Author lny
*/
Public interface genericdao <t extends serializable, PK extends serializable>
{
// -------------------- Basic Search, add, modify, and delete operations --------------------
// Obtain the object based on the primary key. If no corresponding entity exists, null is returned.
Public t get (Pk ID );
// Obtain and lock an object based on the primary key. If no corresponding entity exists, null is returned.
Public t getwithlock (Pk ID, lockmode lock );
// Obtain the object based on the primary key. If no corresponding entity exists, an exception is thrown.
Public t load (Pk ID );
// Obtain and lock an object based on the primary key. If no corresponding entity exists, an exception is thrown.
Public t loadwithlock (Pk ID, lockmode lock );
// Obtain all objects.
Public list <t> loadall ();
// Loadallwithlock ()?
// Update an object
Public void Update (T entity );
// Update and lock the object
Public void updatewithlock (T entity, lockmode lock );
// Store the object to the database
Public void save (T entity );
// Savewithlock ()
// Add or update an object
Public void saveorupdate (T entity );
// Add or update all objects in the Set
Public void saveorupdateall (collection <t> entities );
// Delete the specified object
Public void Delete (T entity );
// Lock and delete the specified object
Public void deletewithlock (T entity, lockmode lock );
// Delete the specified object based on the primary key
Public void deletebykey (Pk ID );
// Lock the primary key and delete the specified object
Public void deletebykeywithlock (Pk ID, lockmode lock );
// Delete all objects in the Set
Public void deleteall (collection <t> entities );
// -------------------- Hsql ----------------------------------------------
// Use the hsql statement to add, update, and delete objects directly.
Public int bulkupdate (string querystring );
// Use the hsql statement with parameters to add, update, and delete objects
Public int bulkupdate (string querystring, object [] values );
// Use an hsql statement to retrieve data
Public list find (string querystring );
// Use a hsql statement with parameters to retrieve data
Public list find (string querystring, object [] values );
// Use the hsql statement with the name parameter to retrieve data
Public list findbynamedparam (string querystring, string [] paramnames, object [] values );
Eg: * string hql = "select count (*) from Member where email =: email and ID! =: ID ";
* List list = This. Support. gethibernatetemplate (). findbynamedparam (hql, new string [] {"email", "ID "},
* New object [] {"sdf@sfd.com", null });
// Use the named hsql statement to retrieve data
Public list findbynamedquery (string queryname );
// Use a named hsql statement with parameters to retrieve data
Public list findbynamedquery (string queryname, object [] values );
// Use the hsql statement with the name parameter to retrieve data
Public list findbynamedqueryandnamedparam (string queryname, string [] paramnames, object [] values );
// Use an hsql statement to retrieve data and return iterator
Public iterator iterate (string querystring );
// Use the hsql statement with parameters to retrieve data and return iterator
Public iterator iterate (string querystring, object [] values );
// Disable iterator returned by Retrieval
Public void closeiterator (iterator it );
// ---------------------------------- Criteria ------------------------------
// Create a standard Object unrelated to the session
Public detachedcriteria createdetachedcriteria ();
// Create a retrieval standard Object bound to the session
Public criteria createcriteria ();
// Use the specified search criteria to retrieve data
Public list findbycriteria (detachedcriteria criteria );
// Use the specified retrieval standard to retrieve data and return some records
Public list findbycriteria (detachedcriteria criteria, int firstresult, int maxresults );
// Retrieve data using the specified object and attribute (except for the primary key and the object value)
Public list <t> findequalbyentity (T entity, string [] propertynames );
// Use the specified object and attribute (non-primary key) to retrieve data that meets the like String object Value
Public list <t> findlikebyentity (T entity, string [] propertynames );
// Use the specified retrieval standard to retrieve data and return records within the specified range
Public integer getrowcount (detachedcriteria criteria );
// Use the specified retrieval standard to retrieve data and return the specified statistical value
Public object getstatvalue (detachedcriteria criteria, string propertyname, string statname );
// ---------------------------------- Others --------------------------------
// Lock the specified object
Public void lock (T entity, lockmode );
// Force initialize the specified object
Public void initialize (Object proxy );
// Force immediately update the buffered data to the database (otherwise, the data is updated only when the transaction is committed)
Public void flush ();
}