Module org.jooq
Package org.jooq

Interface Schema

All Superinterfaces:
Named, QueryPart, Serializable
All Known Implementing Classes:
LazySchema, SchemaImpl

public interface Schema extends Named
A schema.

Standard SQL object identifiers come in 3 parts: [catalog].[schema].[object]. The schema is an object that groups a set of objects, where objects can be Table, Sequence, Routine and many other types of objects.

If your RDBMS supports schemas, and jOOQ supports using schemas with your RDBMS, then generated schemas references can be used to qualify objects

Example:


 // Assuming import static org.jooq.impl.DSL.*;

 using(configuration)
    .select(SCHEMA.ACTOR.FIRST_NAME, SCHEMA.ACTOR.LAST_NAME)
    .from(SCHEMA.ACTOR)
    .fetch();
 

Compatibility:

Database products like SQLDialect.MYSQL and related dialects, such as SQLDialect.MARIADB use catalogs ("databases") instead of schemas, and lack schema support. For historic reasons, jOOQ treats MySQL catalogs as schemas and does not support any catalog qualifier in MySQL.

Instances can be created using DSL.schema(Name) and overloads.

Author:
Lukas Eder
  • Method Details

    • getCatalog

      @Nullable @Nullable Catalog getCatalog()
      The catalog of this schema.
    • tableStream

      @NotNull @NotNull Stream<Table<?>> tableStream()
      Stream all tables contained in this schema.
    • getTables

      @NotNull @NotNull List<Table<?>> getTables()
      List all tables contained in this schema.
    • getTable

      @Nullable @Nullable Table<?> getTable(String name)
      Get a table by its name (case-sensitive) in this schema, or null if no such table exists.
    • getTable

      @Nullable @Nullable Table<?> getTable(Name name)
      Get a table by its qualified or unqualified name in this schema, or null if no such table exists.
    • primaryKeyStream

      @NotNull @NotNull Stream<UniqueKey<?>> primaryKeyStream()
      Stream all primary keys contained in this schema.
    • getPrimaryKeys

      @NotNull @NotNull List<UniqueKey<?>> getPrimaryKeys()
      List all primary keys contained in this schema.
    • getPrimaryKeys

      @NotNull @NotNull List<UniqueKey<?>> getPrimaryKeys(String name)
      Get primary keys by their name (case-sensitive) in this schema.
    • getPrimaryKeys

      @NotNull @NotNull List<UniqueKey<?>> getPrimaryKeys(Name name)
      Get primary keys by their qualified or unqualified name in this schema.
    • uniqueKeyStream

      @NotNull @NotNull Stream<UniqueKey<?>> uniqueKeyStream()
      Stream all unique keys (including primary keys) contained in this schema.
    • getUniqueKeys

      @NotNull @NotNull List<UniqueKey<?>> getUniqueKeys()
      List all unique keys (including primary keys) contained in this schema.
    • getUniqueKeys

      @NotNull @NotNull List<UniqueKey<?>> getUniqueKeys(String name)
      Get unique keys (including primary keys) by their name (case-sensitive) in this schema.
    • getUniqueKeys

      @NotNull @NotNull List<UniqueKey<?>> getUniqueKeys(Name name)
      Get unique keys (including primary keys) by their qualified or unqualified name in this schema.
    • foreignKeyStream

      @NotNull @NotNull Stream<ForeignKey<?,?>> foreignKeyStream()
      Stream all foreign keys contained in this schema.
    • getForeignKeys

      @NotNull @NotNull List<ForeignKey<?,?>> getForeignKeys()
      List all foreign keys contained in this schema.
    • getForeignKeys

      @NotNull @NotNull List<ForeignKey<?,?>> getForeignKeys(String name)
      Get foreign keys by their name (case-sensitive) in this schema.
    • getForeignKeys

      @NotNull @NotNull List<ForeignKey<?,?>> getForeignKeys(Name name)
      Get foreign keys by their qualified or unqualified name in this schema.
    • indexStream

      @NotNull @NotNull Stream<Index> indexStream()
      Stream all indexes contained in this schema.
    • getIndexes

      @NotNull @NotNull List<Index> getIndexes()
      List all indexes contained in this schema.
    • getIndexes

      @NotNull @NotNull List<Index> getIndexes(String name)
      Get indexes by their name (case-sensitive) in this schema.
    • getIndexes

      @NotNull @NotNull List<Index> getIndexes(Name name)
      Get indexes by their qualified or unqualified name in this schema.
    • udtStream

      @NotNull @NotNull Stream<UDT<?>> udtStream()
      Stream all UDTs contained in this schema.
    • getUDTs

      @NotNull @NotNull List<UDT<?>> getUDTs()
      List all UDTs contained in this schema.
    • getUDT

      @Nullable @Nullable UDT<?> getUDT(String name)
      Get a UDT by its name (case-sensitive) in this schema, or null if no such UDT exists.
    • getUDT

      @Nullable @Nullable UDT<?> getUDT(Name name)
      Get a UDT by its qualified or unqualified name in this schema, or null if no such UDT exists.
    • domainStream

      @NotNull @NotNull Stream<Domain<?>> domainStream()
      Stream all domains contained in this schema.
    • getDomains

      @NotNull @NotNull List<Domain<?>> getDomains()
      List all domains contained in this schema.
    • getDomain

      @Nullable @Nullable Domain<?> getDomain(String name)
      Get a domain by its name (case-sensitive) in this schema, or null if no such domain exists.
    • getDomain

      @Nullable @Nullable Domain<?> getDomain(Name name)
      Get a domain by its qualified or unqualified name in this schema, or null if no such domain exists.
    • triggerStream

      @NotNull @NotNull Stream<Trigger> triggerStream()
      Stream all triggers contained in this schema.
    • getTriggers

      @NotNull @NotNull List<Trigger> getTriggers()
      List all triggers contained in this schema.
    • getTrigger

      @Nullable @Nullable Trigger getTrigger(String name)
      Get a trigger by its name (case-sensitive) in this schema, or null if no such domain exists.
    • getTrigger

      @Nullable @Nullable Trigger getTrigger(Name name)
      Get a trigger by its qualified or unqualified name in this schema, or null if no such domain exists.
    • sequenceStream

      @NotNull @NotNull Stream<Sequence<?>> sequenceStream()
      Stream all sequences contained in this schema.
    • getSequences

      @NotNull @NotNull List<Sequence<?>> getSequences()
      List all sequences contained in this schema.
    • getSequence

      @Nullable @Nullable Sequence<?> getSequence(String name)
      Get a sequence by its name (case-sensitive) in this schema, or null if no such sequence exists.
    • getSequence

      @Nullable @Nullable Sequence<?> getSequence(Name name)
      Get a sequence by its qualified or unqualified name in this schema, or null if no such sequence exists.