T
- Entity type that this Repository handlesID
- The type that identifies the ID column for the supported entity typepublic abstract class JpaBaseRepository<T extends Serializable,ID extends Serializable> extends JpaSearchRepository<T,ID> implements BaseRepository<T,ID>
Modifier | Constructor and Description |
---|---|
protected |
JpaBaseRepository() |
Modifier and Type | Method and Description |
---|---|
T |
evict(T entity)
Evicts the supplied entity from the session.
|
protected ID |
extractId(T entity)
Determines the ID for the entity
|
void |
flush()
Synchronises the state of EntityManager for this repository with the database
|
void |
lock(T entity,
javax.persistence.LockModeType lockMode)
Lock an entity instance that is contained in the persistence context with the specified lock
mode type.
|
T |
persist(T entity)
Persists the given entity.
|
T |
refresh(T entity)
Refresh the supplied entity from the database, overriding its state where changed.
|
void |
remove(ID entityId)
Removes the given entity from the database, cascading as appropriate.
|
clear, findById, getEntityClass, getEntityManager, getIdClass, getSingleResult, setEntityManager
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, findById
protected JpaBaseRepository()
protected ID extractId(T entity)
entity
- The entity to retrieve the ID forpublic T persist(T entity)
persist
in interface BaseRepository<T extends Serializable,ID extends Serializable>
entity
- The entity to be persistedpublic void remove(ID entityId)
remove
in interface BaseRepository<T extends Serializable,ID extends Serializable>
entityId
- The ID for the entity to be removedpublic T refresh(T entity)
refresh
in interface BaseRepository<T extends Serializable,ID extends Serializable>
entity
- The entity to be refreshed.public T evict(T entity)
evict
in interface BaseRepository<T extends Serializable,ID extends Serializable>
entity
- The entity to be evicted.public void flush()
flush
in interface BaseRepository<T extends Serializable,ID extends Serializable>
public void lock(T entity, javax.persistence.LockModeType lockMode)
lock
in interface BaseRepository<T extends Serializable,ID extends Serializable>
entity
- The entity to be locked.lockMode
- The LockModeType
EntityManager.lock(Object, LockModeType)
Copyright © 2010–2018 Jadira Systems. All rights reserved.