lucee.Componentcontentbox.modules.contentbox-deps.modules.cborm.models.BaseBuilder
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
string
|
entityName
The entity name this criteria builder is binded to.
|
true
|
false
|
|
any
|
eventManager
The system event manager.
|
true
|
false
|
|
any
|
nativeCriteria
The native criteria object.
|
true
|
false
|
|
boolean
|
SQLLoggerActive
The bit that determines if we are tracking SQL.
|
false
|
true
|
false
|
Constructor Summary | |
---|---|
init(string entityName, any criteria, any restrictions, any ORMService)
Constructor ********************************************. |
Method Summary | |
---|---|
any
|
add(any criterion)
Add a restriction to constrain the results to be retrieved. |
private any
|
addProjection([any propertyName], [any projectionType], [any projectionList])
|
boolean
|
canLogSql()
Returns whether or not CriteriaBuilder is currently configured to log SQL. |
any
|
convertIDValueToJavaType(any id)
Coverts an ID, list of ID's, or array of ID's values to the proper java type. |
any
|
convertValueToJavaType(any propertyName, any value)
Coverts a value to the correct javaType for the property passed in. |
any
|
createAlias(string associationName, string alias, [numeric joinType], [any withClause])
Join an association, assigning an alias to the joined association. |
any
|
createCriteria(string associationName, [string alias], [numeric joinType], [any withClause])
Create a new Criteria, "rooted" at the associated entity and using an Inner Join. |
private any
|
createRestriction(string missingMethodName, struct missingMethodArguments)
|
string
|
getEntityName()
|
string
|
getEventManager()
|
string
|
getNativeCriteria()
|
array
|
getPositionalSQLParameters()
Returns a formatted array of parameter value and types. |
any
|
getPositionalSQLParameterTypes(boolean simple='true')
Gets positional SQL parameter types from the criteria query. |
array
|
getPositionalSQLParameterValues()
Gets the positional SQL parameter values from the criteria query. |
string
|
getSQL(boolean returnExecutableSql='false', boolean formatSql='true')
Returns the SQL string that will be prepared for the criteria object at the time of request. |
array
|
getSQLLog()
Retrieves the SQL Log. |
string
|
getSQLLoggerActive()
|
private boolean
|
hasProjection()
Checks whether or not a projection is currently applied to the CriteriaBuilder. |
void
|
logSQL(string label)
Allows for one-off sql logging at any point in the process of building up CriteriaBuilder; will log the SQL state at the time of the call. |
private void
|
normalizeOrder(string sortOrder, boolean ignoreCase)
|
any
|
order(string property, [string sortDir='asc'], [boolean ignoreCase='false'])
Add an ordering to the result set, you can add as many as you like. |
private struct
|
prepareSQLProjection([any rawProjection])
Helper method to prepare sqlProjection for addition to CriteriaBuilder. |
any
|
resultTransformer([any resultTransformer])
Sets a valid hibernate result transformer: org. |
any
|
setEntityName(any entityName)
|
any
|
setEventManager(any eventManager)
|
any
|
setNativeCriteria(any criteria)
PUBLIC ********************************************. |
any
|
setProjection([any projection])
Setup a single or a projection list via native projections class: criteria. |
any
|
setSQLLoggerActive(boolean SQLLoggerActive)
|
any
|
startSqlLog(any returnExecutableSql='false', any formatSql='false')
Triggers CriteriaBuilder to start internally logging the state of SQL at each iterative build. |
any
|
stopSqlLog()
Stops CriteriaBuilder from continuing to internally log the state of SQL. |
any
|
withProjections([string avg], [string count], [string countDistinct], [any distinct], [string groupProperty], [boolean id], [string max], [string min], [string property], [boolean rowCount], [string sum], [any sqlProjection], [any sqlGroupProjection], [any detachedSQLProjection])
Setup projections for this criteria query, you can pass one or as many projection arguments as you like. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor ********************************************
entityName
criteria
restrictions
ORMService
Property Detail |
---|
The entity name this criteria builder is binded to
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe system event manager
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe native criteria object
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe bit that determines if we are tracking SQL
access
- publicrequired
- falsereturntype
- anyserializable
- trueMethod Detail |
---|
Add a restriction to constrain the results to be retrieved
criterion
- A single or array of criterions to addpropertyName
projectionType
projectionList
Returns whether or not CriteriaBuilder is currently configured to log SQL return Boolean
Coverts an ID, list of ID's, or array of ID's values to the proper java type The method returns a coverted array of ID's
id
Coverts a value to the correct javaType for the property passed in The method returns the value in the proper Java Type
propertyName
value
Join an association, assigning an alias to the joined association.
associationName
- The name of the association propertyalias
- The alias to use for this association property on restrictionsjoinType
- The hibernate join type to use, by default it uses an inner join. Available as properties: criteria.FULL_JOIN, criteria.INNER_JOIN, criteria.LEFT_JOINwithClause
- The criteria to use with the joinCreate a new Criteria, "rooted" at the associated entity and using an Inner Join
associationName
- The name of the association property to root the restrictions withalias
- The alias to use for this association property on restrictionsjoinType
- The hibernate join type to use, by default it uses an inner join. Available as properties: criteria.FULL_JOIN, criteria.INNER_JOIN, criteria.LEFT_JOINwithClause
- The criteria to use with the joinmissingMethodName
missingMethodArguments
Returns a formatted array of parameter value and types return array
Gets positional SQL parameter types from the criteria query return any
simple
- {Boolean} Whether to return a simply array or full objectsGets the positional SQL parameter values from the criteria query return array
Returns the SQL string that will be prepared for the criteria object at the time of request return string
returnExecutableSql
formatSql
Retrieves the SQL Log return Array
Checks whether or not a projection is currently applied to the CriteriaBuilder return Boolean
Allows for one-off sql logging at any point in the process of building up CriteriaBuilder; will log the SQL state at the time of the call return void
label
- {String} The label to use for the sql log recordsortOrder
ignoreCase
Add an ordering to the result set, you can add as many as you like
property
- The name of the property to order onsortDir
ignoreCase
- Wether to ignore case or not, defaults to falseHelper method to prepare sqlProjection for addition to CriteriaBuilder return Struct
rawProjection
- {Struct} The raw projection configurationSets a valid hibernate result transformer: org.hibernate.transform.ResultTransform to use on the results
resultTransformer
- a custom result transform or you can use the included ones: criteria.ALIAS_TO_ENTITY_MAP, criteria.DISTINCT_ROOT_ENTITY, criteria.PROJECTION, criteria.ROOT_ENTITY.entityName
eventManager
PUBLIC ********************************************
criteria
Setup a single or a projection list via native projections class: criteria.projections
projection
SQLLoggerActive
Triggers CriteriaBuilder to start internally logging the state of SQL at each iterative build return CriteriaBuilder
returnExecutableSql
- {Boolean} Whether or not to return sql with query params replaced with positional valuesformatSql
- {Boolean} Whether or not to run sql through formatter and wrap the sql in tags for more readable output
Stops CriteriaBuilder from continuing to internally log the state of SQL return CriteriaBuilder
Setup projections for this criteria query, you can pass one or as many projection arguments as you like. The majority of the arguments take in the property name to do the projection on, which will also use that as the alias for the column or you can pass an alias after the property name separated by a : Ex: projections(avg="balance:avgBalance") The alias on the projected value can be referred to in restrictions or orderings. Please also note that the resulting array locations are done in alphabetical order of the arguments.
avg
- The name of the property to avg or a list or array of property namescount
- The name of the property to count or a list or array of property namescountDistinct
- The name of the property to count distinct or a list or array of property namesdistinct
- The name of the property to do a distinct on, this can be a single property name a list or an array of property namesgroupProperty
- The name of the property to group by or a list or array of property namesid
- The projected identifier valuemax
- The name of the property to max or a list or array of property namesmin
- The name of the property to min or a list or array of property namesproperty
- The name of the property to do a projected value on or a list or array of property namesrowCount
- Do a row count on the criteriasum
- The name of the property to sum or a list or array of property namessqlProjection
- Do a projection based on arbitrary SQL stringsqlGroupProjection
- Do a projection based on arbitrary SQL string, with groupingdetachedSQLProjection
- Do a projection based on a DetachedCriteria builder config