Class ToOneRelationQueryAdapter
- All Implemented Interfaces:
Query, RelationQuery
RelationQuery interface-
Nested Class Summary
Nested classes/interfaces inherited from interface Query
Query.Mode -
Field Summary
Fields inherited from class AbstractRelationQueryAdapter
relationModel, sourceEntityFields inherited from class 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 AbstractRelationQueryAdapter
execute, execute, execute, execute, execute, getManager, getOnlyResult, getOnlyResultOrNull, getRelationModel, getSource, setParameter, toQueryDefinitionMethods inherited from class AbstractOrderableQuery
appendOrder, getOrdering, hasOrdering, prependOrder, withOrderMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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
-
uniqueResultOrNull
-
firstResult
-
firstResultOrNull
-
getOnlyResult
-
getOnlyResultOrNull
-
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.
-