Class ToOneRelationQueryAdapter
- All Implemented Interfaces:
Query,RelationQuery
RelationQuery interface-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.persist.core.api.query.Query
Query.Mode -
Field Summary
Fields inherited from class ch.tocco.nice2.persist.core.impl.hibernate.pojo.relation.AbstractRelationQueryAdapter
relationModel, sourceEntityFields inherited from class ch.tocco.nice2.persist.core.spi.entity.query.ql.AbstractOrderableQuery
ordering -
Constructor Summary
ConstructorsConstructorDescriptionToOneRelationQueryAdapter(Entity sourceEntity, RelationModel relationModel, EntityFacadeListenerManager entityFacadeListenerManager, EntityInterceptor entityInterceptor, PropertyAccessorService propertyAccessorService) -
Method Summary
Modifier and TypeMethodDescriptionintcount()Currently badly implemented! Count the results.execute(Pagination pagination, Query.Mode mode) Execute the query using the specified pagination parameters in the specifiedQuery.Mode.Executes and returns the first selected Entity by this query, or throws.@Nullable EntityExecutes and returns the first selected Entity by this query, or null if none.Executes and returns the single selected Entity by this query, or throws.@Nullable EntityExecutes and returns the single selected Entity by this query, or null if none, or throws.protected @Nullable EntitygetValue()Executes and returns the single selected Entity by this query, or throws.@Nullable EntityExecutes and returns the single selected Entity by this query, or null if none, or throws.Methods inherited from class ch.tocco.nice2.persist.core.impl.hibernate.pojo.relation.AbstractRelationQueryAdapter
execute, execute, execute, execute, execute, getManager, getOnlyResult, getOnlyResultOrNull, getRelationModel, getSource, setParameter, toQueryDefinitionMethods inherited from class ch.tocco.nice2.persist.core.spi.entity.query.ql.AbstractOrderableQuery
appendOrder, getOrdering, hasOrdering, prependOrder, withOrderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.tocco.nice2.persist.core.api.query.Query
appendOrder, getKeys, getKeys, getOrdering, hasOrdering, prependOrder, withOrder
-
Constructor Details
-
ToOneRelationQueryAdapter
public ToOneRelationQueryAdapter(Entity sourceEntity, RelationModel relationModel, EntityFacadeListenerManager entityFacadeListenerManager, EntityInterceptor entityInterceptor, PropertyAccessorService propertyAccessorService)
-
-
Method Details
-
getValue
-
execute
Description copied from interface:QueryExecute the query using the specified pagination parameters in the specifiedQuery.Mode.- Parameters:
pagination- The offset and limit of the query.mode- The mode.- Returns:
- The result of the query.
-
uniqueResult
Description copied from interface:QueryExecutes and returns the single selected Entity by this query, or throws.- Returns:
- The single selected Entity.
- See Also:
-
uniqueResultOrNull
Description copied from interface:QueryExecutes and returns the single selected Entity by this query, or null if none, or throws.- Returns:
- The single selected Entity, or
nullif none. - See Also:
-
firstResult
Description copied from interface:QueryExecutes and returns the first selected Entity by this query, or throws.- Returns:
- The first selected Entity.
- See Also:
-
firstResultOrNull
Description copied from interface:QueryExecutes and returns the first selected Entity by this query, or null if none.- Returns:
- The first selected Entity, or
nullif none. - See Also:
-
getOnlyResult
Description copied from interface:QueryExecutes and returns the single selected Entity by this query, or throws.- Returns:
- The single selected Entity.
- See Also:
-
getOnlyResultOrNull
Description copied from interface:QueryExecutes and returns the single selected Entity by this query, or null if none, or throws.- Returns:
- The single selected Entity, or
nullif none. - See Also:
-
count
public int count()Description copied from interface:QueryCurrently badly implemented! Count the results.WARNING: This method does not behave as "SELECT count()" in SQL does! In fact it is temporarily implemented as a chaining of execute().size() only. No query modification is done etc. ALSO, the default query limit is used and thus if there would be more records, only the default limit is returned. The impl may be rewritten to be what one would expect; until then users may only use this method if they can live with today's limits: small counts.
Speed of "SELECT count()" greatly depends on the underlying db table impl. An example are the two MySQL table types MyISAM and InnoDB. A query-less count on the former returns instantly because it keeps track of the number, whereas the latter needs to iterate over all records (at least in case of non-fixed length record tables) and can take minutes depending on the size.
- Returns:
- The count.
-