T
- the type of the entity with which we will be interacting with the databasePK
- the id of the entity with which we will be interacting with the databasepublic interface TransactionService<T extends JpaEntity<PK>,PK>
Modifier and Type | Method and Description |
---|---|
void |
add(T transientObject)
Adds an object of type T.
|
java.util.List<T> |
batchUpdate(java.util.List<T> transientObjects)
Updates all entities passed in and returns a list of the updated objects
|
T |
find(PK id)
Get a T record using it's id
|
java.util.List<T> |
findAll()
Gets a List
|
T |
merge(T transientObject)
Adds or updates an object of type T
|
java.util.List<T> |
query(java.lang.String queryString,
java.util.Map<java.lang.String,java.lang.Object> queryParameters)
Queries the current table using the passed in where clause
|
void |
remove(T persistentObject)
Deletes entity T from table.
|
void add(T transientObject)
transientObject
- The object to be addedT merge(T transientObject)
transientObject
- The object to be added/updatedT find(PK id) throws javax.persistence.EntityNotFoundException
id
- the primary key of the entityjavax.persistence.EntityNotFoundException
- when no entity with primary key PK existsjava.util.List<T> findAll()
void remove(T persistentObject) throws javax.persistence.EntityNotFoundException
persistentObject
- Entity to deletejavax.persistence.EntityNotFoundException
- if the instance is not an entity or is a detached entityjava.util.List<T> query(java.lang.String queryString, java.util.Map<java.lang.String,java.lang.Object> queryParameters)
queryString
- a query stringqueryParameters
- parameters to inject into the queryString