Class QueryBuilderFactoryImpl
java.lang.Object
ch.tocco.nice2.persist.core.impl.hibernate.query.builder.QueryBuilderFactoryImpl
- All Implemented Interfaces:
QueryBuilderFactory
-
Constructor Summary
ConstructorDescriptionQueryBuilderFactoryImpl
(PersistenceService persistenceService, TypeManager typeManager) -
Method Summary
Modifier and TypeMethodDescriptionasPredicate
(Condition condition) Create a newCountQueryBuilder
which executes count queries.Create a newCountQueryBuilder
which executes count queries.Create a newCountQueryBuilder
which executes count queries.Create a newCountQueryBuilder
which executes count queries.boolean
Evaluates the given `condition` against the given entity.Create anEntityQueryBuilder
with the provided entity model as rootresolve
(EntityReference source, Path relationPath) resolve
(EntityReference source, String relationPath) Create anEntityQueryBuilder
that first resolves the given relation path and uses the target entity model of the given relation path as query root.<E> SinglePathQueryBuilder
<E> Create aSinglePathQueryBuilder
with the provided entity model as root and the single column as selection<T> PathQueryBuilder
<T> Create aPathQueryBuilder
with the provided entity model as root and the provided columns as selectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.persist.core.api.hibernate.query.builder.QueryBuilderFactory
evaluate, select
-
Constructor Details
-
QueryBuilderFactoryImpl
-
-
Method Details
-
find
Description copied from interface:QueryBuilderFactory
Create anEntityQueryBuilder
with the provided entity model as root- Specified by:
find
in interfaceQueryBuilderFactory
- Parameters:
entityModel
- the target entity model- Returns:
- the created
EntityQueryBuilder
-
findKeys
- Specified by:
findKeys
in interfaceQueryBuilderFactory
-
select
Description copied from interface:QueryBuilderFactory
Create aPathQueryBuilder
with the provided entity model as root and the provided columns as selection- Specified by:
select
in interfaceQueryBuilderFactory
- Parameters:
returnType
- the type the query returns, currently either Map or Object[]entityModel
- the target entity modelcolumns
- the columns to select- Returns:
- the created
PathQueryBuilder
-
select
Description copied from interface:QueryBuilderFactory
Create aSinglePathQueryBuilder
with the provided entity model as root and the single column as selection- Specified by:
select
in interfaceQueryBuilderFactory
- Type Parameters:
E
- the return type, equal to the type of the selected column- Parameters:
type
- the type of the selected columnentityModel
- the target entity modelcolumn
- the selected column- Returns:
- the created
SinglePathQueryBuilder
-
resolve
Description copied from interface:QueryBuilderFactory
Create anEntityQueryBuilder
that first resolves the given relation path and uses the target entity model of the given relation path as query root.- Specified by:
resolve
in interfaceQueryBuilderFactory
- Parameters:
source
- the source entityrelationPath
- the relation path, e.g. 'relAddress_user.relAddress'- Returns:
- the created
EntityQueryBuilder
-
resolve
- Specified by:
resolve
in interfaceQueryBuilderFactory
-
count
Description copied from interface:QueryBuilderFactory
Create a newCountQueryBuilder
which executes count queries.- Specified by:
count
in interfaceQueryBuilderFactory
- Parameters:
entityClass
- the root entity
-
count
Description copied from interface:QueryBuilderFactory
Create a newCountQueryBuilder
which executes count queries.- Specified by:
count
in interfaceQueryBuilderFactory
- Parameters:
modelName
- the model name of the root entity
-
count
Description copied from interface:QueryBuilderFactory
Create a newCountQueryBuilder
which executes count queries.- Specified by:
count
in interfaceQueryBuilderFactory
- Parameters:
entityClass
- the root entityhints
- optional hints about the query (seeQueryHints
for available hints)
-
count
Description copied from interface:QueryBuilderFactory
Create a newCountQueryBuilder
which executes count queries.- Specified by:
count
in interfaceQueryBuilderFactory
- Parameters:
modelName
- the model name of the root entityhints
- optional hints about the query (seeQueryHints
for available hints)
-
evaluate
Description copied from interface:QueryBuilderFactory
Evaluates the given `condition` against the given entity. Returns `true` if the entity would have been returned from a query formed by `condition`, `false` otherwise. The `params` map must contain all parameter values if those are used within the `condition`. Note that subqueries (like `EXISTS` and `COUNT`) and functions (like `fulltext` or `DISTANCE`) are currently *not* supported. `JdbcFunction`s (like `DISTANCE`) can't work anyways as they are directly translated to database calls.- Specified by:
evaluate
in interfaceQueryBuilderFactory
-
asPredicate
Description copied from interface:QueryBuilderFactory
Get aPredicate
for the providedCondition
. It can be used, for example to filter a list of previously loadedEntity
s.- Specified by:
asPredicate
in interfaceQueryBuilderFactory
- Parameters:
condition
- aCondition
-