T
- The Entity to work onpublic abstract class AbstractBean<T>
extends java.lang.Object
Constructor and Description |
---|
AbstractBean(java.lang.Class<T> entityClass)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
count()
Returns the number of entities available.
|
void |
create(T entity)
Persist an entity to the database.
|
void |
edit(T entity)
Updates an entity.
|
T |
find(java.lang.Long id)
Retrieves an identity.
|
java.util.List<T> |
findAll()
Retrieve all instances of the entity.
|
java.util.List<T> |
findRange(int[] range)
TODO: an array? Seems weird.
|
protected abstract javax.persistence.EntityManager |
getEntityManager()
Returns the Entity manager.
|
void |
remove(T entity)
Deletes an entity.
|
public AbstractBean(java.lang.Class<T> entityClass)
entityClass
- the class of the entity on which this class
is to perform its operations.protected abstract javax.persistence.EntityManager getEntityManager()
public void create(T entity)
entity
- public void edit(T entity)
entity
- public void remove(T entity)
entity
- public T find(java.lang.Long id)
id
- the primary key/unique identifier of the entitypublic java.util.List<T> findAll()
public java.util.List<T> findRange(int[] range)
range
- integer array, containing row numbers, size of two, first is the first row
and last is the last row (exclusive).public int count()