-
- Type Parameters:
R
- TheFOREIGN KEY
's owner table recordO
- The referencedKEY
's owner table record
- All Superinterfaces:
Key<R>
,Named
,QueryPart
,Serializable
public interface ForeignKey<R extends Record,O extends Record> extends Key<R>
AForeignKey
is an object referencing aUniqueKey
. It represents aFOREIGN KEY
relationship between two tables.Instances of this type cannot be created directly. They are available from generated code.
- Author:
- Lukas Eder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Table<R>
children(Collection<? extends O> records)
Get a table expression representing the children of a record, given this foreign key.@NotNull Table<R>
children(O record)
Get a table expression representing the children of a record, given this foreign key.@NotNull Table<R>
children(O... records)
Get a table expression representing the children of a record, given this foreign key.@NotNull Result<R>
fetchChildren(Collection<? extends O> records)
Fetch child records of a given set of records through this foreign key@NotNull Result<R>
fetchChildren(O record)
Fetch child records of a given record through this foreign key@NotNull Result<R>
fetchChildren(O... records)
Fetch child records of a given set of records through this foreign keyO
fetchParent(R record)
Fetch a parent record of a given record through this foreign key@NotNull Result<O>
fetchParents(Collection<? extends R> records)
Fetch parent records of a given set of record through this foreign key@NotNull Result<O>
fetchParents(R... records)
Fetch parent records of a given set of record through this foreign key@NotNull UniqueKey<O>
getKey()
The referencedUniqueKey
.@NotNull List<TableField<O,?>>
getKeyFields()
The fields that make up the referencedUniqueKey
.@NotNull TableField<O,?>[]
getKeyFieldsArray()
The fields that make up the referencedUniqueKey
.@NotNull Table<O>
parent(R record)
Get a table expression representing the parent of a record, given this foreign key.@NotNull Table<O>
parents(Collection<? extends R> records)
Get a table expression representing the parents of a record, given this foreign key.@NotNull Table<O>
parents(R... records)
Get a table expression representing the parents of a record, given this foreign key.-
Methods inherited from interface org.jooq.Key
constraint, enforced, getFields, getFieldsArray, getTable, nullable
-
Methods inherited from interface org.jooq.Named
getComment, getCommentPart, getName, getQualifiedName, getUnqualifiedName
-
-
-
-
Method Detail
-
getKeyFields
@NotNull @NotNull List<TableField<O,?>> getKeyFields()
The fields that make up the referencedUniqueKey
.This returns the order in which the fields of
getKey()
are referenced, which is usually the same as the fields ofKey.getFields()
, but not necessarily so.
-
getKeyFieldsArray
@NotNull @NotNull TableField<O,?>[] getKeyFieldsArray()
The fields that make up the referencedUniqueKey
.This returns the order in which the fields of
getKey()
are referenced, which is usually the same as the fields ofKey.getFieldsArray()
, but not necessarily so.- See Also:
getKeyFields()
-
fetchParent
@Nullable O fetchParent(R record) throws DataAccessException
Fetch a parent record of a given record through this foreign keyThis returns a parent record referenced by a given record through this foreign key, as if fetching from
parent(Record)
. If no parent record was found, this returnsnull
- Throws:
DataAccessException
- if something went wrong executing the query- See Also:
TableRecord.fetchParent(ForeignKey)
-
fetchParents
@NotNull @NotNull Result<O> fetchParents(R... records) throws DataAccessException
Fetch parent records of a given set of record through this foreign keyThis returns parent records referenced by any record in a given set of records through this foreign key, as if fetching from
parents(Record...)
.- Throws:
DataAccessException
- if something went wrong executing the query- See Also:
TableRecord.fetchParent(ForeignKey)
-
fetchParents
@NotNull @NotNull Result<O> fetchParents(Collection<? extends R> records) throws DataAccessException
Fetch parent records of a given set of record through this foreign keyThis returns parent records referenced by any record in a given set of records through this foreign key, as if fetching from
parents(Collection)
.- Throws:
DataAccessException
- if something went wrong executing the query- See Also:
TableRecord.fetchParent(ForeignKey)
-
fetchChildren
@NotNull @NotNull Result<R> fetchChildren(O record) throws DataAccessException
Fetch child records of a given record through this foreign keyThis returns childs record referencing a given record through this foreign key, as if fetching from
children(Record)
.- Throws:
DataAccessException
- if something went wrong executing the query- See Also:
UpdatableRecord.fetchChild(ForeignKey)
,UpdatableRecord.fetchChildren(ForeignKey)
-
fetchChildren
@NotNull @NotNull Result<R> fetchChildren(O... records) throws DataAccessException
Fetch child records of a given set of records through this foreign keyThis returns childs record referencing any record in a given set of records through this foreign key, as if fetching from
children(Record...)
.- Throws:
DataAccessException
- if something went wrong executing the query- See Also:
UpdatableRecord.fetchChild(ForeignKey)
,UpdatableRecord.fetchChildren(ForeignKey)
-
fetchChildren
@NotNull @NotNull Result<R> fetchChildren(Collection<? extends O> records) throws DataAccessException
Fetch child records of a given set of records through this foreign keyThis returns childs record referencing any record in a given set of records through this foreign key, as if fetching from
children(Collection)
.- Throws:
DataAccessException
- if something went wrong executing the query- See Also:
UpdatableRecord.fetchChild(ForeignKey)
,UpdatableRecord.fetchChildren(ForeignKey)
-
parent
@NotNull @NotNull Table<O> parent(R record)
Get a table expression representing the parent of a record, given this foreign key.
-
parents
@NotNull @NotNull Table<O> parents(R... records)
Get a table expression representing the parents of a record, given this foreign key.
-
parents
@NotNull @NotNull Table<O> parents(Collection<? extends R> records)
Get a table expression representing the parents of a record, given this foreign key.
-
children
@NotNull @NotNull Table<R> children(O record)
Get a table expression representing the children of a record, given this foreign key.
-
children
@NotNull @NotNull Table<R> children(O... records)
Get a table expression representing the children of a record, given this foreign key.
-
children
@NotNull @NotNull Table<R> children(Collection<? extends O> records)
Get a table expression representing the children of a record, given this foreign key.
-
-