be.destin.beans
Class Persist<T,ID extends java.io.Serializable>

java.lang.Object
  extended by be.destin.beans.Persist<T,ID>
All Implemented Interfaces:
PersistInterface

public class Persist<T,ID extends java.io.Serializable>
extends java.lang.Object
implements PersistInterface


Constructor Summary
Persist()
           
 
Method Summary
 int countAll()
          Count all entities
 int countByExample(java.lang.Object exampleInstance)
          Count entities based on an example
 void delete(java.lang.Object entity)
          delete an entity from the database
 java.util.List findAll()
          Load all entities
 java.util.List findByExample(java.lang.Object exampleInstance)
          Find entities based on an example
 java.lang.Object findById(java.io.Serializable id)
          Find an entity by its primary key
 java.util.List findByNamedQuery(java.lang.String queryName, java.lang.Object... params)
          Find using a named query
 java.util.List findByNamedQueryAndNamedParams(java.lang.String queryName, java.util.Map params)
          Find using a named query
 java.lang.Class getEntityClass()
          Get the Class of the entity
 java.lang.Object save(java.lang.Object entity)
          save an entity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Persist

public Persist()
Method Detail

countAll

public int countAll()
Description copied from interface: PersistInterface
Count all entities

Specified by:
countAll in interface PersistInterface
Returns:
the number of entities

countByExample

public int countByExample(java.lang.Object exampleInstance)
Description copied from interface: PersistInterface
Count entities based on an example

Specified by:
countByExample in interface PersistInterface
Parameters:
exampleInstance - the search criteria
Returns:
the number of entities

delete

public void delete(java.lang.Object entity)
Description copied from interface: PersistInterface
delete an entity from the database

Specified by:
delete in interface PersistInterface
Parameters:
entity - the entity to delete

findAll

public java.util.List findAll()
Description copied from interface: PersistInterface
Load all entities

Specified by:
findAll in interface PersistInterface
Returns:
the list of entities

findByExample

public java.util.List findByExample(java.lang.Object exampleInstance)
Description copied from interface: PersistInterface
Find entities based on an example

Specified by:
findByExample in interface PersistInterface
Parameters:
exampleInstance - the example
Returns:
the list of entities

findById

public java.lang.Object findById(java.io.Serializable id)
Description copied from interface: PersistInterface
Find an entity by its primary key

Specified by:
findById in interface PersistInterface
Parameters:
id - the primary key
Returns:
the entity

findByNamedQuery

public java.util.List findByNamedQuery(java.lang.String queryName,
                                       java.lang.Object... params)
Description copied from interface: PersistInterface
Find using a named query

Specified by:
findByNamedQuery in interface PersistInterface
Parameters:
queryName - the name of the query
params - the query parameters
Returns:
the list of entities

findByNamedQueryAndNamedParams

public java.util.List findByNamedQueryAndNamedParams(java.lang.String queryName,
                                                     java.util.Map params)
Description copied from interface: PersistInterface
Find using a named query

Specified by:
findByNamedQueryAndNamedParams in interface PersistInterface
Parameters:
queryName - the name of the query
params - the query parameters
Returns:
the list of entities

getEntityClass

public java.lang.Class getEntityClass()
Description copied from interface: PersistInterface
Get the Class of the entity

Specified by:
getEntityClass in interface PersistInterface
Returns:
the class

save

public java.lang.Object save(java.lang.Object entity)
Description copied from interface: PersistInterface
save an entity. This can be either a INSERT or UPDATE in the database

Specified by:
save in interface PersistInterface
Parameters:
entity - the entity to save
Returns:
the saved entity