public class AbstractQueryableDaoImpl<T> extends GenericDaoImpl<T> implements QueryableDao<T>
getQueryObject(Query, boolean)
is a useful method by itself.em
ct, t
Constructor and Description |
---|
AbstractQueryableDaoImpl() |
AbstractQueryableDaoImpl(Class<T> t) |
Modifier and Type | Method and Description |
---|---|
protected String |
conditionConstruct(String name,
Object value,
Field f,
Map<String,Object[]> querableFieldNames)
Construct the Where clause of the Query.
|
Long |
count(Query<T> query)
|
protected static <SUB_T,T> List<SUB_T> |
ensureRowIsEntity(List<T> rows,
List<String> resultFieldNames,
Class<T> queryClass,
Class<SUB_T> resultClass)
Due to varied column selection, it is possible that result rows may not be an Entity SUB_T.
|
protected List<T> |
ensureRowIsEntity(Query<T> query,
List rows,
List<String> resultFieldNames)
Due to varied column selection, it is possible that result rows may not be an Entity T.
|
T |
getEntityInstance()
The entity instance maybe an extension of the Base ensure Queries work for extensions
derive the exact instance required for the Query.
|
protected ExtendedJPAQuery |
getQueryObject(Query<T> query,
boolean count)
Create a {javax.persistence.Query} object based on conditions and criteria (input domain based
Query ) |
List<T> |
query(Query<T> query)
|
<SUB_T> List<SUB_T> |
query(Query<T> query,
Class<SUB_T> claz)
Derive a SubSet (claz) of T only as an queried entity.
|
Page<T> |
queryPage(Query<T> query)
|
<SUB_T> Page<SUB_T> |
queryPage(Query<T> query,
Class<SUB_T> claz)
Derive a SubSet (claz) of T only as an queried entity.
|
delete, delete, getEntityManager, getNativeEntityName, load, load, paginate, query, query, save, setEntityManager, update
public T getEntityInstance()
QueryableDao
getEntityInstance
in interface QueryableDao<T>
protected String conditionConstruct(String name, Object value, Field f, Map<String,Object[]> querableFieldNames)
Queryable
annotation is defined.name
- as Stringvalue
- as the Value (for the criteria) for the field namef
- as Field
querableFieldNames
- as Map of String Object[]protected ExtendedJPAQuery getQueryObject(Query<T> query, boolean count) throws Exception
Query
)query
- as Query
count
- as boolean; if true will convert the query to return just a count, in which case dropIfLargeAmt is ignoredExtendedJPAQuery
Exception
protected final List<T> ensureRowIsEntity(Query<T> query, List rows, List<String> resultFieldNames) throws Exception
query
- as Query
of Trows
- as List of Object[] (result) of raw queryresultFieldNames
- as List<String>.
Exception
protected static <SUB_T,T> List<SUB_T> ensureRowIsEntity(List<T> rows, List<String> resultFieldNames, Class<T> queryClass, Class<SUB_T> resultClass) throws Exception
rows
- as List of Object[] (result) of raw queryresultFieldNames
- as List<String>queryClass
- as Class of TresultClass
- as Class of SUB_TException
- if resultFieldNames is not providedpublic List<T> query(Query<T> query) throws Exception
Query
and on Queryable
fields only.
Queryable
fields will face problems.query
in interface QueryableDao<T>
query
- as Queryable
Exception
public Page<T> queryPage(Query<T> query) throws Exception
Query
and on Queryable
fields only.
Query.setNullSet(Set)
Queryable
fields will face problems.queryPage
in interface QueryableDao<T>
query
- as Queryable
Exception
public Long count(Query<T> query) throws Exception
Query
and on Queryable
fields only.
Query.setNullSet(Set)
Queryable
fields will face problems.count
in interface QueryableDao<T>
query
- as Queryable
Exception
public <SUB_T> List<SUB_T> query(Query<T> query, Class<SUB_T> claz) throws Exception
public <SUB_T> Page<SUB_T> queryPage(Query<T> query, Class<SUB_T> claz) throws Exception
Copyright © 2018. All rights reserved.