- All Implemented Interfaces:
DAO<R,
P, T>
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected T
compositeKeyRecord
(Object... values) Expose the configuration in whose context thisDAO
is operating.long
count()
Count all records of the underlying table.ctx()
void
delete
(Collection<P> objects) Performs aDELETE
statement for a given set of POJOs.void
Performs aDELETE
statement for a POJOvoid
Performs aDELETE
statement for a given set of POJOs.void
deleteById
(Collection<T> ids) Performs aDELETE
statement for a given set of IDs.void
deleteById
(T... ids) Performs aDELETE
statement for a given set of IDs.dialect()
TheSQLDialect
wrapped by this context.boolean
Checks if a given POJO exists.boolean
existsById
(T id) Checks if a given ID exists.family()
TheSQLDialect.family()
wrapped by this context.fetch
(Field<Z> field, Collection<? extends Z> values) Find records by a given field and a set of values.Find records by a given field and a set of values.<Z> P
Find a unique record by a given field and a value.fetchOptional
(Field<Z> field, Z value) Find a unique record by a given field and a value.fetchRange
(Field<Z> field, Z lowerInclusive, Z upperInclusive) Find records by a given field and a range of values.findAll()
Find all records of the underlying table.Find a record of the underlying table by ID.findOptionalById
(T id) Find a record of the underlying table by ID.getTable()
Get the underlying table.getType()
Get the underlying POJO type.void
insert
(Collection<P> objects) Performs a batchINSERT
statement for a given set of POJOs.void
Performs anINSERT
statement for a given POJO.void
Performs a batchINSERT
statement for a given set of POJOs.mapper()
Expose theRecordMapper
that is used internally by thisDAO
to map from records of typeR
to POJOs of typeP
.void
merge
(Collection<P> objects) Performs a batchMERGE
statement for a given set of POJOs.void
Performs anMERGE
statement for a given POJO.void
Performs a batchMERGE
statement for a given set of POJOs.void
setConfiguration
(Configuration configuration) Inject a configuration.settings()
The settings wrapped by this context.void
update
(Collection<P> objects) Performs a batchUPDATE
statement for a given set of POJOs.void
Performs anUPDATE
statement for a given POJO.void
Performs a batchUPDATE
statement for a given set of POJOs.
-
Constructor Details
-
DAOImpl
-
DAOImpl
-
-
Method Details
-
setConfiguration
Inject a configuration.This method is maintained to be able to configure a
DAO
using Spring. It is not exposed in the public API. -
ctx
-
configuration
Description copied from interface:DAO
Expose the configuration in whose context thisDAO
is operating.- Specified by:
configuration
in interfaceDAO<R extends UpdatableRecord<R>,
P, T> - Returns:
- the
DAO
's underlyingConfiguration
-
settings
Description copied from interface:DAO
The settings wrapped by this context.This method is a convenient way of accessing
configuration().settings()
. -
dialect
Description copied from interface:DAO
TheSQLDialect
wrapped by this context.This method is a convenient way of accessing
configuration().dialect()
. -
family
Description copied from interface:DAO
TheSQLDialect.family()
wrapped by this context.This method is a convenient way of accessing
configuration().family()
. -
mapper
Expose theRecordMapper
that is used internally by thisDAO
to map from records of typeR
to POJOs of typeP
.Subclasses may override this method to provide custom implementations.
-
insert
Description copied from interface:DAO
Performs anINSERT
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 aRecord.into(Object)
call. -
insert
Description copied from interface:DAO
Performs a batchINSERT
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 aRecord.into(Object)
call. -
insert
Description copied from interface:DAO
Performs a batchINSERT
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 aRecord.into(Object)
call. -
update
Description copied from interface:DAO
Performs anUPDATE
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 aRecord.into(Object)
call, ifUPDATE … RETURNING
is supported by the dialect. -
update
Description copied from interface:DAO
Performs a batchUPDATE
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 aRecord.into(Object)
call, ifUPDATE … RETURNING
is supported by the dialect. -
update
Description copied from interface:DAO
Performs a batchUPDATE
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 aRecord.into(Object)
call, ifUPDATE … RETURNING
is supported by the dialect. -
merge
Description copied from interface:DAO
Performs anMERGE
statement for a given POJO. -
merge
Description copied from interface:DAO
Performs a batchMERGE
statement for a given set of POJOs. -
merge
Description copied from interface:DAO
Performs a batchMERGE
statement for a given set of POJOs. -
delete
Description copied from interface:DAO
Performs aDELETE
statement for a POJO -
delete
Description copied from interface:DAO
Performs aDELETE
statement for a given set of POJOs. -
delete
Description copied from interface:DAO
Performs aDELETE
statement for a given set of POJOs. -
deleteById
Description copied from interface:DAO
Performs aDELETE
statement for a given set of IDs.- Specified by:
deleteById
in interfaceDAO<R extends UpdatableRecord<R>,
P, T> - Parameters:
ids
- The IDs to be deleted- See Also:
-
deleteById
Description copied from interface:DAO
Performs aDELETE
statement for a given set of IDs.- Specified by:
deleteById
in interfaceDAO<R extends UpdatableRecord<R>,
P, T> - Parameters:
ids
- The IDs to be deleted- See Also:
-
exists
Description copied from interface:DAO
Checks if a given POJO exists. -
existsById
Description copied from interface:DAO
Checks if a given ID exists.- Specified by:
existsById
in interfaceDAO<R extends UpdatableRecord<R>,
P, T> - Parameters:
id
- The ID whose existence is checked- Returns:
- Whether the ID already exists
-
count
public long count()Description copied from interface:DAO
Count all records of the underlying table. -
findAll
Description copied from interface:DAO
Find all records of the underlying table. -
findById
Description copied from interface:DAO
Find a record of the underlying table by ID. -
findOptionalById
Description copied from interface:DAO
Find a record of the underlying table by ID.- Specified by:
findOptionalById
in interfaceDAO<R extends UpdatableRecord<R>,
P, T> - Parameters:
id
- The ID of a record in the underlying table- Returns:
- A record of the underlying table given its ID.
-
fetchRange
Description copied from interface:DAO
Find records by a given field and a range of values.- Specified by:
fetchRange
in interfaceDAO<R extends UpdatableRecord<R>,
P, T> - Parameters:
field
- The field to compare values againstlowerInclusive
- The range's lower bound (inclusive), or unbounded ifnull
.upperInclusive
- The range's upper bound (inclusive), or unbounded ifnull
.- Returns:
- A list of records fulfilling
field BETWEEN lowerInclusive AND upperInclusive
-
fetch
Description copied from interface:DAO
Find records by a given field and a set of values. -
fetch
Description copied from interface:DAO
Find records by a given field and a set of values. -
fetchOne
Description copied from interface:DAO
Find a unique record by a given field and a value. -
fetchOptional
Description copied from interface:DAO
Find a unique record by a given field and a value.- Specified by:
fetchOptional
in interfaceDAO<R extends UpdatableRecord<R>,
P, T> - Parameters:
field
- The field to compare value againstvalue
- The accepted value- Returns:
- A record fulfilling
field = value
-
getTable
Description copied from interface:DAO
Get the underlying table. -
getType
Description copied from interface:DAO
Get the underlying POJO type. -
compositeKeyRecord
-