Class ToOneRelationQueryAdapter

All Implemented Interfaces:
Query, RelationQuery

public class ToOneRelationQueryAdapter extends AbstractRelationQueryAdapter
Maps a to-one hibernate collection the RelationQuery interface
  • Constructor Details

  • Method Details

    • getValue

      @Nullable protected @Nullable Entity getValue()
    • execute

      public Relation execute(Pagination pagination, Query.Mode mode)
      Description copied from interface: Query
      Execute the query using the specified pagination parameters in the specified Query.Mode.
      Parameters:
      pagination - The offset and limit of the query.
      mode - The mode.
      Returns:
      The result of the query.
    • uniqueResult

      public Entity uniqueResult()
      Description copied from interface: Query
      Executes and returns the single selected Entity by this query, or throws.
      Returns:
      The single selected Entity.
      See Also:
    • uniqueResultOrNull

      @Nullable public @Nullable Entity uniqueResultOrNull()
      Description copied from interface: Query
      Executes and returns the single selected Entity by this query, or null if none, or throws.
      Returns:
      The single selected Entity, or null if none.
      See Also:
    • firstResult

      public Entity firstResult()
      Description copied from interface: Query
      Executes and returns the first selected Entity by this query, or throws.
      Returns:
      The first selected Entity.
      See Also:
    • firstResultOrNull

      @Nullable public @Nullable Entity firstResultOrNull()
      Description copied from interface: Query
      Executes and returns the first selected Entity by this query, or null if none.
      Returns:
      The first selected Entity, or null if none.
      See Also:
    • getOnlyResult

      public Entity getOnlyResult()
      Description copied from interface: Query
      Executes and returns the single selected Entity by this query, or throws.
      Returns:
      The single selected Entity.
      See Also:
    • getOnlyResultOrNull

      @Nullable public @Nullable Entity getOnlyResultOrNull()
      Description copied from interface: Query
      Executes and returns the single selected Entity by this query, or null if none, or throws.
      Returns:
      The single selected Entity, or null if none.
      See Also:
    • count

      public int count()
      Description copied from interface: Query
      Currently 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.