T - public class BullhornDao<T extends AbstractDto> extends java.lang.Object implements GenericDao<T,java.lang.Integer>
| Constructor and Description |
|---|
BullhornDao(java.lang.Class<T> type) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(T transientObject)
Adds an object of type T.
|
void |
batchMerge(java.util.List<T> listToMerge)
Handles batch insert or batch update.
|
T |
find(java.lang.Integer id)
Get a T record using it's id
|
java.util.List<T> |
findAll()
Gets a List
|
BullhornAPI |
getBullhornApi() |
EntityIdHelper<T,java.lang.Integer> |
getEntityIdHelper()
The entity id helper is used to get the id of the generic entity T.
|
ApiEntityName |
getEntityName() |
java.lang.Class<T> |
getType() |
T |
merge(T transientObject)
Adds or updates an object of type T
|
java.lang.Integer |
mergeAndReturnID(T transientObject)
Adds or updates an object of type T and returns the ID
|
java.util.List<T> |
query(java.lang.String whereClause) |
java.util.List<T> |
query(java.lang.String queryString,
java.util.Map<java.lang.String,java.lang.Object> queryParameters)
Query using the passed in query, with named parameters contained in the queryParameters.
|
java.util.List<T> |
query(java.lang.String queryString,
java.util.Map<java.lang.String,java.lang.Object> queryParameters,
java.lang.Integer limit)
Query using the passed in query, with named parameters contained in the queryParameters.
|
java.util.List<T> |
query(java.lang.String queryString,
java.util.Map<java.lang.String,java.lang.Object> queryParameters,
java.lang.Integer limit,
java.lang.Integer start)
Query using the passed in query, with named parameters contained in the queryParameters.
|
void |
remove(T persistentObject)
Deletes entity T from table.
|
void |
setBullhornApi(BullhornAPI bullhornApi) |
void |
setEntityManager(javax.persistence.EntityManager entityManager)
Added for testing
|
public BullhornDao(java.lang.Class<T> type)
public void add(T transientObject)
GenericDaoadd in interface GenericDao<T extends AbstractDto,java.lang.Integer>transientObject - The object to be addedpublic T merge(T transientObject)
GenericDaomerge in interface GenericDao<T extends AbstractDto,java.lang.Integer>transientObject - The object to be added/updatedpublic java.lang.Integer mergeAndReturnID(T transientObject)
GenericDaomergeAndReturnID in interface GenericDao<T extends AbstractDto,java.lang.Integer>transientObject - The object to be added/updatedpublic T find(java.lang.Integer id) throws javax.persistence.EntityNotFoundException
GenericDaofind in interface GenericDao<T extends AbstractDto,java.lang.Integer>id - the primary key of the entityjavax.persistence.EntityNotFoundException - when no entity with unique identifier ID existspublic java.util.List<T> findAll()
GenericDaofindAll in interface GenericDao<T extends AbstractDto,java.lang.Integer>public void remove(T persistentObject) throws javax.persistence.EntityNotFoundException
GenericDaoremove in interface GenericDao<T extends AbstractDto,java.lang.Integer>persistentObject - Entity to deletejavax.persistence.EntityNotFoundException - if the instance is not an entity or is a detached entitypublic java.util.List<T> query(java.lang.String whereClause)
public java.util.List<T> query(java.lang.String queryString, java.util.Map<java.lang.String,java.lang.Object> queryParameters)
GenericDaoDo not concatenate the queryString with parameters before passing it in to this method! We should be using named parameters via the queryParamters to avoid SQL-injection attacks.
query in interface GenericDao<T extends AbstractDto,java.lang.Integer>queryString - The query to execute, with named parameters if neededqueryParameters - The parameters that will be used for the query. If null then query executes without params.public java.util.List<T> query(java.lang.String queryString, java.util.Map<java.lang.String,java.lang.Object> queryParameters, java.lang.Integer limit)
GenericDaoDo not concatenate the queryString with parameters before passing it in to this method! We should be using named parameters via the queryParamters to avoid SQL-injection attacks.
query in interface GenericDao<T extends AbstractDto,java.lang.Integer>queryString - The query to execute, with named parameters if neededqueryParameters - The parameters that will be used for the query. If null then query executes without params.limit - the maximum number of elements to returnpublic java.util.List<T> query(java.lang.String queryString, java.util.Map<java.lang.String,java.lang.Object> queryParameters, java.lang.Integer limit, java.lang.Integer start)
GenericDaoDo not concatenate the queryString with parameters before passing it in to this method! We should be using named parameters via the queryParamters to avoid SQL-injection attacks.
query in interface GenericDao<T extends AbstractDto,java.lang.Integer>queryString - The query to execute, with named parameters if neededqueryParameters - The parameters that will be used for the query. If null then query executes without params.limit - the index of the record which we want to be the first returned based on the sort in the queryStringstart - the maximum number of elements to returnpublic void setEntityManager(javax.persistence.EntityManager entityManager)
GenericDaosetEntityManager in interface GenericDao<T extends AbstractDto,java.lang.Integer>entityManager - the entityManager to setpublic java.lang.Class<T> getType()
public ApiEntityName getEntityName()
public BullhornAPI getBullhornApi()
public void setBullhornApi(BullhornAPI bullhornApi)
public EntityIdHelper<T,java.lang.Integer> getEntityIdHelper()
public void batchMerge(java.util.List<T> listToMerge)
GenericDaobatchMerge in interface GenericDao<T extends AbstractDto,java.lang.Integer>listToMerge - the list of elements to merge