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
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
 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... 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
 boolean exists(P object)
          Checks if a given POJO exists
 boolean existsById(T id)
          Checks if a given ID exists
 List<P> findAll()
          Find all records of the underlying table.
 P findById(T id)
          Find a record of the underlying table by ID.
 Table<R> getTable()
          Get the underlying table
 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... 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 update(Collection<P> objects)
          Performs a batch UPDATE statement for a given set of POJOs
 void update(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
 

Method Detail

insert

void insert(P object)
            throws DataAccessException
Performs an INSERT statement for a given POJO

Parameters:
object - The POJO to be inserted
Throws:
DataAccessException - if something went wrong executing the query

insert

void insert(P... objects)
            throws DataAccessException
Performs a batch INSERT statement for a given set of POJOs

Parameters:
objects - The POJOs to be inserted
Throws:
DataAccessException - if something went wrong executing the query
See Also:
insert(Collection)

insert

void insert(Collection<P> objects)
            throws DataAccessException
Performs a batch INSERT statement for a given set of POJOs

Parameters:
objects - The POJOs to be inserted
Throws:
DataAccessException - if something went wrong executing the query
See Also:
insert(Object...)

update

void update(P object)
            throws DataAccessException
Performs an UPDATE statement for a given POJO

Parameters:
object - The POJO to be updated
Throws:
DataAccessException - if something went wrong executing the query

update

void update(P... objects)
            throws DataAccessException
Performs a batch UPDATE statement for a given set of POJOs

Parameters:
objects - The POJOs to be updated
Throws:
DataAccessException - if something went wrong executing the query
See Also:
update(Collection)

update

void update(Collection<P> objects)
            throws DataAccessException
Performs a batch UPDATE statement for a given set of POJOs

Parameters:
objects - The POJOs to be updated
Throws:
DataAccessException - if something went wrong executing the query
See Also:
update(Object...)

delete

void delete(P... objects)
            throws DataAccessException
Performs a DELETE statement for a given set of POJOs

Parameters:
objects - The POJOs to be deleted
Throws:
DataAccessException - if something went wrong executing the query
See Also:
delete(Collection)

delete

void delete(Collection<P> objects)
            throws DataAccessException
Performs a DELETE statement for a given set of POJOs

Parameters:
objects - The POJOs to be deleted
Throws:
DataAccessException - if something went wrong executing the query
See Also:
delete(Object...)

deleteById

void deleteById(T... ids)
                throws DataAccessException
Performs a DELETE statement for a given set of IDs

Parameters:
ids - The IDs to be deleted
Throws:
DataAccessException - if something went wrong executing the query
See Also:
delete(Collection)

deleteById

void deleteById(Collection<T> ids)
                throws DataAccessException
Performs a DELETE statement for a given set of IDs

Parameters:
ids - The IDs to be deleted
Throws:
DataAccessException - if something went wrong executing the query
See Also:
delete(Object...)

exists

boolean exists(P object)
               throws DataAccessException
Checks if a given POJO exists

Parameters:
object - The POJO whose existence is checked
Returns:
Whether the POJO already exists
Throws:
DataAccessException - if something went wrong executing the query

existsById

boolean existsById(T id)
                   throws DataAccessException
Checks if a given ID exists

Parameters:
id - The ID whose existence is checked
Returns:
Whether the ID already exists
Throws:
DataAccessException - if something went wrong executing the query

count

long count()
           throws DataAccessException
Count all records of the underlying table.

Returns:
The number of records of the underlying table
Throws:
DataAccessException - if something went wrong executing the query

findAll

List<P> findAll()
                throws DataAccessException
Find all records of the underlying table.

Returns:
All records of the underlying table
Throws:
DataAccessException - if something went wrong executing the query

findById

P findById(T id)
           throws DataAccessException
Find a record of the underlying table by ID.

Parameters:
id - The ID of a record in the underlying table
Returns:
A record of the underlying table given its ID, or null if no record was found.
Throws:
DataAccessException - if something went wrong executing the query

getTable

Table<R> getTable()
Get the underlying table


getType

Class<P> getType()
Get the underlying POJO type



Copyright © 2012. All Rights Reserved.