Top Description Fields Constructors Methods
org.jooq.impl

public abstract Class DAOImpl<R extends org.jooq.UpdatableRecord<R>, P, T>

extends Object
implements DAO<R extends UpdatableRecord<R>, P, T>
Class Inheritance
All Implemented Interfaces
org.jooq.DAO
Static Imports
java.lang.Boolean.FALSE, .Boolean.TRUE, java.util.Arrays.asList, .Collections.singletonList, org.jooq.RecordListener.onStoreEnd, org.jooq.impl.DSL.noCondition, .DSL.row, .Tools.EMPTY_RECORD

A common base implementation for generated DAO.

Unlike many other elements in the jOOQ API, DAO may be used in the context of Spring, CDI, or EJB lifecycle management. This means that no methods in the DAO type hierarchy must be made final. See also https://github.com/jOOQ/ jOOQ/issues/4696 for more details.

Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
private Configuration
private RecordMapper<R, P>
private final Table<R>
private final Class<P>

Constructor Summary

AccessConstructor and Description
protected
DAOImpl(Table<R> table, Class<P> type)

protected
DAOImpl(Table<R> table, Class<P> type, Configuration configuration)

Method Summary

Modifier and TypeMethod and Description
protected T
public Configuration
configuration()

Implements org.jooq.DAO.configuration.

Expose the configuration in whose context this DAO is operating.
public long
count()

Implements org.jooq.DAO.count.

Count all records of the underlying table.
public DSLContext
ctx()

public void
delete(P
The POJO to be deleted
object
)

Implements org.jooq.DAO.delete.

Performs a DELETE statement for a POJO
public void
delete(P...
The POJOs to be deleted
objects
)

Implements org.jooq.DAO.delete, org.jooq.DAO.delete.

Performs a DELETE statement for a given set of POJOs.
public void
delete(Collection<P>
The POJOs to be deleted
objects
)

Implements org.jooq.DAO.delete, org.jooq.DAO.delete.

Performs a DELETE statement for a given set of POJOs.
public void
deleteById(T
The IDs to be deleted
ids
)

Implements org.jooq.DAO.deleteById.

Performs a DELETE statement for a given set of IDs.
public void
deleteById(T...
The IDs to be deleted
ids
)

Implements org.jooq.DAO.deleteById, org.jooq.DAO.deleteById.

Performs a DELETE statement for a given set of IDs.
public void
deleteById(Collection<T>
The IDs to be deleted
ids
)

Implements org.jooq.DAO.deleteById, org.jooq.DAO.deleteById.

Performs a DELETE statement for a given set of IDs.
public SQLDialect
dialect()

Implements org.jooq.DAO.dialect.

The SQLDialect wrapped by this context.
private Condition
equal(Field<?>[] pk, T id)

Deprecated as a consequence of Field and Condition being deprecated.
private Condition
equal(Field<?>[] pk, Collection<T> ids)

Deprecated as a consequence of Field and Condition being deprecated.
public boolean
exists(P
The POJO whose existence is checked
object
)

Implements org.jooq.DAO.exists.

Checks if a given POJO exists.
public boolean
existsById(T
The ID whose existence is checked
id
)

Implements org.jooq.DAO.existsById.

Checks if a given ID exists.
public SQLDialect
family()

Implements org.jooq.DAO.family.

The SQLDialect#family() wrapped by this context.
public <Z> List<P>
fetch(Field<Z>
The field to compare values against
field
,
Z...
The accepted values
values
)

Implements org.jooq.DAO.fetch.

Deprecated as a consequence of Field being deprecated.
Find records by a given field and a set of values.
public <Z> List<P>
fetch(Field<Z>
The field to compare values against
field
,
Collection<? extends Z>
The accepted values
values
)

Implements org.jooq.DAO.fetch.

Deprecated as a consequence of Field being deprecated.
Find records by a given field and a set of values.
public <Z> P
fetchOne(Field<Z>
The field to compare value against
field
,
Z
The accepted value
value
)

Implements org.jooq.DAO.fetchOne.

Deprecated as a consequence of Field being deprecated.
Find a unique record by a given field and a value.
public <Z> Optional<P>
fetchOptional(Field<Z>
The field to compare value against
field
,
Z
The accepted value
value
)

Implements org.jooq.DAO.fetchOptional.

Deprecated as a consequence of Field being deprecated.
Find a unique record by a given field and a value.
public <Z> List<P>
fetchRange(Field<Z>
The field to compare values against
field
,
Z
The range's lower bound (inclusive), or unbounded if null.
lowerInclusive
,
Z
The range's upper bound (inclusive), or unbounded if null.
upperInclusive
)

Implements org.jooq.DAO.fetchRange.

Deprecated as a consequence of Field being deprecated.
Find records by a given field and a range of values.
public List<P>
findAll()

Implements org.jooq.DAO.findAll.

Find all records of the underlying table.
public P
findById(T
The ID of a record in the underlying table
id
)

Implements org.jooq.DAO.findById.

Find a record of the underlying table by ID.
public Optional<P>
findOptionalById(T
The ID of a record in the underlying table
id
)

Implements org.jooq.DAO.findOptionalById.

Find a record of the underlying table by ID.
public Table<R>
getTable()

Implements org.jooq.DAO.getTable.

Get the underlying table.
public Class<P>
getType()

Implements org.jooq.DAO.getType.

Get the underlying POJO type.
public void
insert(P
The POJO to be inserted
object
)

Implements org.jooq.DAO.insert.

Performs an INSERT statement for a given POJO.
public void
insert(P...
The POJOs to be inserted
objects
)

Implements org.jooq.DAO.insert, org.jooq.DAO.insert.

Performs a batch INSERT statement for a given set of POJOs.
public void
insert(Collection<P>
The POJOs to be inserted
objects
)

Implements org.jooq.DAO.insert, org.jooq.DAO.insert.

Performs a batch INSERT statement for a given set of POJOs.
public RecordMapper<R, P>
mapper()

Implements org.jooq.DAO.mapper.

Expose the RecordMapper that is used internally by this DAO to map from records of type R to POJOs of type P.
public void
merge(P
The POJO to be merged
object
)

Implements org.jooq.DAO.merge.

Performs an MERGE statement for a given POJO.
public void
merge(P...
The POJOs to be merged
objects
)

Implements org.jooq.DAO.merge, org.jooq.DAO.merge.

Performs a batch MERGE statement for a given set of POJOs.
public void
merge(Collection<P>
The POJOs to be merged
objects
)

Implements org.jooq.DAO.merge, org.jooq.DAO.merge.

Performs a batch MERGE statement for a given set of POJOs.
private Field<?>[]
pk()

Deprecated as a consequence of Field being deprecated.
private RecordListenerProvider[]
providers(final RecordListenerProvider[] providers, final IdentityHashMap<R, Object> mapping)

private List<R>
records(Collection<P> objects, boolean forUpdate)

private final boolean
public void
setConfiguration(Configuration configuration)

Inject a configuration.

public Settings
settings()

Implements org.jooq.DAO.settings.

The settings wrapped by this context.
public void
update(P
The POJO to be updated
object
)

Implements org.jooq.DAO.update.

Performs an UPDATE statement for a given POJO.
public void
update(P...
The POJOs to be updated
objects
)

Implements org.jooq.DAO.update, org.jooq.DAO.update.

Performs a batch UPDATE statement for a given set of POJOs.
public void
update(Collection<P>
The POJOs to be updated
objects
)

Implements org.jooq.DAO.update, org.jooq.DAO.update.

Performs a batch UPDATE statement for a given set of POJOs.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationback to summary
private Configuration configuration
mapperback to summary
private RecordMapper<R, P> mapper
tableback to summary
private final Table<R> table
typeback to summary
private final Class<P> type

Constructor Detail

DAOImplback to summary
protected DAOImpl(Table<R> table, Class<P> type)
DAOImplback to summary
protected DAOImpl(Table<R> table, Class<P> type, Configuration configuration)

Method Detail

compositeKeyRecordback to summary
protected T compositeKeyRecord(Object... values)
Annotations
@SuppressWarnings:unchecked
configurationback to summary
public Configuration configuration()

Implements org.jooq.DAO.configuration.

Doc from org.jooq.DAO.configuration.

Expose the configuration in whose context this DAO is operating.

Returns:Configuration

the DAO's underlying Configuration

Annotations
@Override
countback to summary
public long count()

Implements org.jooq.DAO.count.

Doc from org.jooq.DAO.count.

Count all records of the underlying table.

Returns:long

The number of records of the underlying table

Annotations
@Override
ctxback to summary
public DSLContext ctx()
deleteback to summary
public void delete(P object)

Implements org.jooq.DAO.delete.

Doc from org.jooq.DAO.delete.

Performs a DELETE statement for a POJO

Parameters
object:P

The POJO to be deleted

Annotations
@Override
deleteback to summary
public void delete(P... objects)

Implements org.jooq.DAO.delete, org.jooq.DAO.delete.

Doc from org.jooq.DAO.delete.

Performs a DELETE statement for a given set of POJOs.

Parameters
objects:P[]

The POJOs to be deleted

Annotations
@SuppressWarnings:unchecked
@Override
deleteback to summary
public void delete(Collection<P> objects)

Implements org.jooq.DAO.delete, org.jooq.DAO.delete.

Doc from org.jooq.DAO.delete.

Performs a DELETE statement for a given set of POJOs.

Parameters
objects:Collection<P>

The POJOs to be deleted

Annotations
@Override
deleteByIdback to summary
public void deleteById(T ids)

Implements org.jooq.DAO.deleteById.

Doc from org.jooq.DAO.deleteById.

Performs a DELETE statement for a given set of IDs.

Parameters
ids:T

The IDs to be deleted

Annotations
@Override
deleteByIdback to summary
public void deleteById(T... ids)

Implements org.jooq.DAO.deleteById, org.jooq.DAO.deleteById.

Doc from org.jooq.DAO.deleteById.

Performs a DELETE statement for a given set of IDs.

Parameters
ids:T[]

The IDs to be deleted

Annotations
@SuppressWarnings:unchecked
@Override
deleteByIdback to summary
public void deleteById(Collection<T> ids)

Implements org.jooq.DAO.deleteById, org.jooq.DAO.deleteById.

Doc from org.jooq.DAO.deleteById.

Performs a DELETE statement for a given set of IDs.

Parameters
ids:Collection<T>

The IDs to be deleted

Annotations
@Override
dialectback to summary
public SQLDialect dialect()

Implements org.jooq.DAO.dialect.

Doc from org.jooq.DAO.dialect.

The SQLDialect wrapped by this context.

This method is a convenient way of accessing configuration().dialect().

Annotations
@Override
equalback to summary
private Condition equal(Field<?>[] pk, T id)

Deprecated

as a consequence of Field and Condition being deprecated. See corresponding docs for further information.

Annotations
@SuppressWarnings:unchecked
equalback to summary
private Condition equal(Field<?>[] pk, Collection<T> ids)

Deprecated

as a consequence of Field and Condition being deprecated. See corresponding docs for further information.

Annotations
@SuppressWarnings:unchecked
existsback to summary
public boolean exists(P object)

Implements org.jooq.DAO.exists.

Doc from org.jooq.DAO.exists.

Checks if a given POJO exists.

Parameters
object:P

The POJO whose existence is checked

Returns:boolean

Whether the POJO already exists

Annotations
@Override
existsByIdback to summary
public boolean existsById(T id)

Implements org.jooq.DAO.existsById.

Doc from org.jooq.DAO.existsById.

Checks if a given ID exists.

Parameters
id:T

The ID whose existence is checked

Returns:boolean

Whether the ID already exists

Annotations
@Override
familyback to summary
public SQLDialect family()

Implements org.jooq.DAO.family.

Doc from org.jooq.DAO.family.

The SQLDialect#family() wrapped by this context.

This method is a convenient way of accessing configuration().family().

Annotations
@Override
fetchback to summary
public <Z> List<P> fetch(Field<Z> field, Z... values)

Implements org.jooq.DAO.fetch.

Doc from org.jooq.DAO.fetch.

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Find records by a given field and a set of values.

Parameters
field:Field<Z>

The field to compare values against

values:Z[]

The accepted values

Returns:List<P>

A list of records fulfilling field IN (values)

Annotations
@SuppressWarnings:unchecked
@Override
fetchback to summary
public <Z> List<P> fetch(Field<Z> field, Collection<? extends Z> values)

Implements org.jooq.DAO.fetch.

Doc from org.jooq.DAO.fetch.

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Find records by a given field and a set of values.

Parameters
field:Field<Z>

The field to compare values against

values:Collection<? extends Z>

The accepted values

Returns:List<P>

A list of records fulfilling field IN (values)

Annotations
@Override
fetchOneback to summary
public <Z> P fetchOne(Field<Z> field, Z value)

Implements org.jooq.DAO.fetchOne.

Doc from org.jooq.DAO.fetchOne.

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Find a unique record by a given field and a value.

Parameters
field:Field<Z>

The field to compare value against

value:Z

The accepted value

Returns:P

A record fulfilling field = value, or null

Annotations
@Override
fetchOptionalback to summary
public <Z> Optional<P> fetchOptional(Field<Z> field, Z value)

Implements org.jooq.DAO.fetchOptional.

Doc from org.jooq.DAO.fetchOptional.

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Find a unique record by a given field and a value.

Parameters
field:Field<Z>

The field to compare value against

value:Z

The accepted value

Returns:Optional<P>

A record fulfilling field = value

Annotations
@Override
fetchRangeback to summary
public <Z> List<P> fetchRange(Field<Z> field, Z lowerInclusive, Z upperInclusive)

Implements org.jooq.DAO.fetchRange.

Doc from org.jooq.DAO.fetchRange.

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

Find records by a given field and a range of values.

Parameters
field:Field<Z>

The field to compare values against

lowerInclusive:Z

The range's lower bound (inclusive), or unbounded if null.

upperInclusive:Z

The range's upper bound (inclusive), or unbounded if null.

Returns:List<P>

A list of records fulfilling field BETWEEN lowerInclusive AND upperInclusive

Annotations
@Override
findAllback to summary
public List<P> findAll()

Implements org.jooq.DAO.findAll.

Doc from org.jooq.DAO.findAll.

Find all records of the underlying table.

Returns:List<P>

All records of the underlying table

Annotations
@Override
findByIdback to summary
public P findById(T id)

Implements org.jooq.DAO.findById.

Doc from org.jooq.DAO.findById.

Find a record of the underlying table by ID.

Parameters
id:T

The ID of a record in the underlying table

Returns:P

A record of the underlying table given its ID, or null if no record was found.

Annotations
@Override
findOptionalByIdback to summary
public Optional<P> findOptionalById(T id)

Implements org.jooq.DAO.findOptionalById.

Doc from org.jooq.DAO.findOptionalById.

Find a record of the underlying table by ID.

Parameters
id:T

The ID of a record in the underlying table

Returns:Optional<P>

A record of the underlying table given its ID.

Annotations
@Override
getTableback to summary
public Table<R> getTable()

Implements org.jooq.DAO.getTable.

Doc from org.jooq.DAO.getTable.

Get the underlying table.

Annotations
@Override
getTypeback to summary
public Class<P> getType()

Implements org.jooq.DAO.getType.

Doc from org.jooq.DAO.getType.

Get the underlying POJO type.

Annotations
@Override
insertback to summary
public void insert(P object)

Implements org.jooq.DAO.insert.

Doc from org.jooq.DAO.insert.

Performs an INSERT statement for a given POJO.

Depending on various settings, like Settings#isReturnRecordToPojo(), Settings#isReturnIdentityOnUpdatableRecord(), Settings#isReturnAllOnUpdatableRecord(), and others, the argument POJO, if mutable, will receive any server side generated values using a Record#into(Object) call.

Parameters
object:P

The POJO to be inserted

Annotations
@Override
insertback to summary
public void insert(P... objects)

Implements org.jooq.DAO.insert, org.jooq.DAO.insert.

Doc from org.jooq.DAO.insert.

Performs a batch INSERT statement for a given set of POJOs.

Depending on various settings, like Settings#isReturnRecordToPojo(), Settings#isReturnIdentityOnUpdatableRecord(), Settings#isReturnAllOnUpdatableRecord(), and others, the argument POJO, if mutable, will receive any server side generated values using a Record#into(Object) call.

Parameters
objects:P[]

The POJOs to be inserted

Annotations
@SuppressWarnings:unchecked
@Override
insertback to summary
public void insert(Collection<P> objects)

Implements org.jooq.DAO.insert, org.jooq.DAO.insert.

Doc from org.jooq.DAO.insert.

Performs a batch INSERT statement for a given set of POJOs.

Depending on various settings, like Settings#isReturnRecordToPojo(), Settings#isReturnIdentityOnUpdatableRecord(), Settings#isReturnAllOnUpdatableRecord(), and others, the argument POJO, if mutable, will receive any server side generated values using a Record#into(Object) call.

Parameters
objects:Collection<P>

The POJOs to be inserted

Annotations
@Override
mapperback to summary
public RecordMapper<R, P> mapper()

Implements org.jooq.DAO.mapper.

Doc from org.jooq.DAO.mapper.

Expose the RecordMapper that is used internally by this DAO to map from records of type R to POJOs of type P.

Subclasses may override this method to provide custom implementations.

Returns:RecordMapper<R, P>

the DAO's underlying RecordMapper

Annotations
@Override
mergeback to summary
public void merge(P object)

Implements org.jooq.DAO.merge.

Doc from org.jooq.DAO.merge.

Performs an MERGE statement for a given POJO.

Parameters
object:P

The POJO to be merged

Annotations
@Override
mergeback to summary
public void merge(P... objects)

Implements org.jooq.DAO.merge, org.jooq.DAO.merge.

Doc from org.jooq.DAO.merge.

Performs a batch MERGE statement for a given set of POJOs.

Parameters
objects:P[]

The POJOs to be merged

Annotations
@SuppressWarnings:unchecked
@Override
mergeback to summary
public void merge(Collection<P> objects)

Implements org.jooq.DAO.merge, org.jooq.DAO.merge.

Doc from org.jooq.DAO.merge.

Performs a batch MERGE statement for a given set of POJOs.

Parameters
objects:Collection<P>

The POJOs to be merged

Annotations
@Override
pkback to summary
private Field<?>[] pk()

Deprecated

as a consequence of Field being deprecated. See corresponding docs for further information.

providersback to summary
private RecordListenerProvider[] providers(final RecordListenerProvider[] providers, final IdentityHashMap<R, Object> mapping)
recordsback to summary
private List<R> records(Collection<P> objects, boolean forUpdate)
returnAnyOnUpdatableRecordback to summary
private final boolean returnAnyOnUpdatableRecord()
setConfigurationback to summary
public void setConfiguration(Configuration configuration)

Inject a configuration.

This method is maintained to be able to configure a DAO using Spring. It is not exposed in the public API.

settingsback to summary
public Settings settings()

Implements org.jooq.DAO.settings.

Doc from org.jooq.DAO.settings.

The settings wrapped by this context.

This method is a convenient way of accessing configuration().settings().

Annotations
@Override
updateback to summary
public void update(P object)

Implements org.jooq.DAO.update.

Doc from org.jooq.DAO.update.

Performs an UPDATE statement for a given POJO.

Depending on various settings, like Settings#isReturnRecordToPojo(), Settings#isReturnIdentityOnUpdatableRecord(), Settings#isReturnAllOnUpdatableRecord(), and others, the argument POJO, if mutable, will receive any server side generated values using a Record#into(Object) call, if UPDATE … RETURNING is supported by the dialect.

Parameters
object:P

The POJO to be updated

Annotations
@Override
updateback to summary
public void update(P... objects)

Implements org.jooq.DAO.update, org.jooq.DAO.update.

Doc from org.jooq.DAO.update.

Performs a batch UPDATE statement for a given set of POJOs.

Depending on various settings, like Settings#isReturnRecordToPojo(), Settings#isReturnIdentityOnUpdatableRecord(), Settings#isReturnAllOnUpdatableRecord(), and others, the argument POJO, if mutable, will receive any server side generated values using a Record#into(Object) call, if UPDATE … RETURNING is supported by the dialect.

Parameters
objects:P[]

The POJOs to be updated

Annotations
@SuppressWarnings:unchecked
@Override
updateback to summary
public void update(Collection<P> objects)

Implements org.jooq.DAO.update, org.jooq.DAO.update.

Doc from org.jooq.DAO.update.

Performs a batch UPDATE statement for a given set of POJOs.

Depending on various settings, like Settings#isReturnRecordToPojo(), Settings#isReturnIdentityOnUpdatableRecord(), Settings#isReturnAllOnUpdatableRecord(), and others, the argument POJO, if mutable, will receive any server side generated values using a Record#into(Object) call, if UPDATE … RETURNING is supported by the dialect.

Parameters
objects:Collection<P>

The POJOs to be updated

Annotations
@Override