Module org.jooq
Package org.jooq

Interface DAO<R extends TableRecord<R>,​P,​T>

  • Type Parameters:
    R - The generic record type.
    P - The generic POJO type.
    T - The generic primary key type. This is a regular <T> type for single-column keys, or a Record subtype for composite keys.
    All Known Implementing Classes:
    DAOImpl

    public interface DAO<R extends TableRecord<R>,​P,​T>
    A generic DAO interface for a pojo and a primary key type.

    This type is implemented by generated DAO classes to provide a common API for common actions on POJOs

    Author:
    Lukas Eder
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @NotNull Configuration configuration()
      Expose the configuration in whose context this DAO is operating.
      long count()
      Count all records of the underlying table.
      void delete​(Collection<P> objects)
      Performs a DELETE statement for a given set of POJOs.
      void delete​(P object)
      Performs a DELETE statement for a POJO
      void delete​(P... objects)
      Performs a DELETE statement for a given set of POJOs.
      void deleteById​(Collection<T> ids)
      Performs a DELETE statement for a given set of IDs.
      void deleteById​(T... ids)
      Performs a DELETE statement for a given set of IDs.
      @NotNull SQLDialect dialect()
      The SQLDialect wrapped by this context.
      boolean exists​(P object)
      Checks if a given POJO exists.
      boolean existsById​(T id)
      Checks if a given ID exists.
      @NotNull SQLDialect family()
      The SQLDialect.family() wrapped by this context.
      <Z> @NotNull List<P> fetch​(Field<Z> field, Z... values)
      Find records by a given field and a set of values.
      <Z> P fetchOne​(Field<Z> field, Z value)
      Find a unique record by a given field and a value.
      <Z> @NotNull Optional<P> fetchOptional​(Field<Z> field, Z value)
      Find a unique record by a given field and a value.
      <Z> @NotNull List<P> fetchRange​(Field<Z> field, Z lowerInclusive, Z upperInclusive)
      Find records by a given field and a range of values.
      @NotNull List<P> findAll()
      Find all records of the underlying table.
      P findById​(T id)
      Find a record of the underlying table by ID.
      T getId​(P object)
      Extract the ID value from a POJO.
      @NotNull Table<R> getTable()
      Get the underlying table.
      @NotNull Class<P> getType()
      Get the underlying POJO type.
      void insert​(Collection<P> objects)
      Performs a batch INSERT statement for a given set of POJOs.
      void insert​(P object)
      Performs an INSERT statement for a given POJO.
      void insert​(P... objects)
      Performs a batch INSERT statement for a given set of POJOs.
      @NotNull RecordMapper<R,​P> mapper()
      Expose the RecordMapper that is used internally by this DAO to map from records of type R to POJOs of type P.
      void merge​(Collection<P> objects)
      Performs a batch MERGE statement for a given set of POJOs.
      void merge​(P object)
      Performs an MERGE statement for a given POJO.
      void merge​(P... objects)
      Performs a batch MERGE statement for a given set of POJOs.
      @NotNull Settings settings()
      The settings wrapped by this context.
      void update​(Collection<P> objects)
      Performs a batch UPDATE statement for a given set of POJOs.
      void update​(P object)
      Performs an UPDATE statement for a given POJO.
      void update​(P... objects)
      Performs a batch UPDATE statement for a given set of POJOs.