public class AbstractRepository<T extends AbstractEntity> extends Object
Modifier and Type | Field and Description |
---|---|
protected javax.persistence.EntityManager |
em |
Modifier | Constructor and Description |
---|---|
protected |
AbstractRepository() |
Modifier and Type | Method and Description |
---|---|
long |
countAll()
Returns the number of all entities in the database
|
void |
delete(Long id)
Delete a given entity by id
|
void |
delete(T entity)
Delete a given entity from
|
int |
deleteAll()
Delete all entities
BEWARE: It doesn't trigger cascade or removeOrphan functionality for the deleted entites,
because it is an JQL statement, not an @{link EntityManager} method.
|
List<T> |
findAll()
Find all entities
|
T |
findById(long id)
Find a given entity by id
|
T |
saveAndFlush(T entity)
Save the given entity and flush
|
@Transactional public T saveAndFlush(T entity)
@Transactional public void delete(Long id)
@Transactional public void delete(T entity)
public T findById(long id)
public long countAll()
@Transactional public int deleteAll()
Copyright © 2015. All rights reserved.