E - F - public abstract class EntityJpaControllerAbstract<E,F> extends Object implements Serializable
| Constructor and Description |
|---|
EntityJpaControllerAbstract(javax.persistence.EntityManagerFactory emf,
Class<E> entityClass)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
create(E entity)
Persists a new object using default parameters
|
void |
create(E entity,
EntityPersistenceProperties properties)
Persists a new object
|
void |
destroy(F id) |
void |
destroy(F id,
EntityPersistenceProperties properties) |
void |
edit(E entity)
Edits an existing entity
|
void |
edit(E entity,
EntityPersistenceProperties properties)
Edits an existing entity
|
List<E> |
findEntities() |
List<E> |
findEntities(EntityPersistenceProperties properties) |
List<E> |
findEntities(int maxResults,
int firstResult) |
List<E> |
findEntities(int maxResults,
int firstResult,
EntityPersistenceProperties properties) |
Optional<E> |
findEntity(F id)
Find the entity with the specified key.
|
int |
getEntityCount()
Get number of existing entities
|
javax.persistence.EntityManager |
getEntityManager() |
protected abstract F |
getId(E entity)
Users will be required to specify the method of retrieving primary key from this entity
|
public javax.persistence.EntityManager getEntityManager()
protected abstract F getId(E entity)
entity - public void create(E entity) throws PreexistingEntityException, IllegalArgumentException, Exception
entity - PreexistingEntityExceptionIllegalArgumentExceptionExceptionpublic void create(E entity, EntityPersistenceProperties properties) throws PreexistingEntityException, IllegalArgumentException, Exception
entity - properties - PreexistingEntityExceptionIllegalArgumentExceptionExceptionpublic void edit(E entity) throws NonexistentEntityException, Exception
entity - NonexistentEntityExceptionExceptionpublic void edit(E entity, EntityPersistenceProperties properties) throws NonexistentEntityException, Exception
entity - properties - NonexistentEntityExceptionExceptionpublic void destroy(F id) throws NonexistentEntityException, RollbackFailureException, Exception
id - NonexistentEntityExceptionRollbackFailureExceptionExceptionpublic void destroy(F id, EntityPersistenceProperties properties) throws NonexistentEntityException, RollbackFailureException, Exception
id - properties - NonexistentEntityExceptionRollbackFailureExceptionExceptionpublic List<E> findEntities(EntityPersistenceProperties properties)
properties - public List<E> findEntities(int maxResults, int firstResult)
maxResults - firstResult - public List<E> findEntities(int maxResults, int firstResult, EntityPersistenceProperties properties)
maxResults - firstResult - properties - public Optional<E> findEntity(F id)
id - public int getEntityCount()
Copyright © 2017. All rights reserved.