be.destin.beans
Interface PersistInterface<T,ID extends java.io.Serializable>

All Known Implementing Classes:
Persist

public interface PersistInterface<T,ID extends java.io.Serializable>


Method Summary
 int countAll()
          Count all entities
 int countByExample(T exampleInstance)
          Count entities based on an example
 void delete(T entity)
          delete an entity from the database
 java.util.List<T> findAll()
          Load all entities
 java.util.List<T> findByExample(T exampleInstance)
          Find entities based on an example
 T findById(ID id)
          Find an entity by its primary key
 java.util.List<T> findByNamedQuery(java.lang.String queryName, java.lang.Object... params)
          Find using a named query
 java.util.List<T> findByNamedQueryAndNamedParams(java.lang.String queryName, java.util.Map<java.lang.String,? extends java.lang.Object> params)
          Find using a named query
 java.lang.Class<T> getEntityClass()
          Get the Class of the entity
 T save(T entity)
          save an entity.
 

Method Detail

getEntityClass

java.lang.Class<T> getEntityClass()
Get the Class of the entity

Returns:
the class

findById

T findById(ID id)
Find an entity by its primary key

Parameters:
id - the primary key
Returns:
the entity

findAll

java.util.List<T> findAll()
Load all entities

Returns:
the list of entities

findByExample

java.util.List<T> findByExample(T exampleInstance)
Find entities based on an example

Parameters:
exampleInstance - the example
Returns:
the list of entities

findByNamedQuery

java.util.List<T> findByNamedQuery(java.lang.String queryName,
                                   java.lang.Object... params)
Find using a named query

Parameters:
queryName - the name of the query
params - the query parameters
Returns:
the list of entities

findByNamedQueryAndNamedParams

java.util.List<T> findByNamedQueryAndNamedParams(java.lang.String queryName,
                                                 java.util.Map<java.lang.String,? extends java.lang.Object> params)
Find using a named query

Parameters:
queryName - the name of the query
params - the query parameters
Returns:
the list of entities

countAll

int countAll()
Count all entities

Returns:
the number of entities

countByExample

int countByExample(T exampleInstance)
Count entities based on an example

Parameters:
exampleInstance - the search criteria
Returns:
the number of entities

save

T save(T entity)
save an entity. This can be either a INSERT or UPDATE in the database

Parameters:
entity - the entity to save
Returns:
the saved entity

delete

void delete(T entity)
delete an entity from the database

Parameters:
entity - the entity to delete