[jOOQ/jOOQ#13069] Generate convenience methods for common MULTISET and ROW nestings

This commit is contained in:
Lukas Eder 2022-02-15 16:41:25 +01:00
parent dbd7b51daa
commit b8f1d35876
20 changed files with 1426 additions and 17 deletions

View File

@ -69,6 +69,9 @@ abstract class AbstractGenerator implements Generator {
boolean generateIndexes = true;
boolean generateRelations = true;
boolean generateImplicitJoinPathsToOne = true;
boolean generateRowConvenienceToOne = true;
boolean generateMultisetConvenienceOneToMany = true;
boolean generateMultisetConvenienceManyToMany = true;
boolean generateInstanceFields = true;
VisibilityModifier generateVisibilityModifier = VisibilityModifier.DEFAULT;
boolean generateGeneratedAnnotation = false;
@ -287,6 +290,36 @@ abstract class AbstractGenerator implements Generator {
this.generateImplicitJoinPathsToOne = generateImplicitJoinPathsToOne;
}
@Override
public boolean generateRowConvenienceToOne() {
return generateRowConvenienceToOne && generateRelations();
}
@Override
public void setGenerateRowConvenienceToOne(boolean generateRowConvenienceToOne) {
this.generateRowConvenienceToOne = generateRowConvenienceToOne;
}
@Override
public boolean generateMultisetConvenienceOneToMany() {
return generateMultisetConvenienceOneToMany && generateRelations();
}
@Override
public void setGenerateMultisetConvenienceOneToMany(boolean generateMultisetConvenienceOneToMany) {
this.generateMultisetConvenienceOneToMany = generateMultisetConvenienceOneToMany;
}
@Override
public boolean generateMultisetConvenienceManyToMany() {
return generateMultisetConvenienceManyToMany && generateRelations();
}
@Override
public void setGenerateMultisetConvenienceManyToMany(boolean generateMultisetConvenienceManyToMany) {
this.generateMultisetConvenienceManyToMany = generateMultisetConvenienceManyToMany;
}
@Override
public boolean generateTableValuedFunctions() {
return generateTableValuedFunctions;

View File

@ -705,6 +705,12 @@ public class GenerationTool {
generator.setGenerateRelations(g.getGenerate().isRelations());
if (g.getGenerate().isImplicitJoinPathsToOne() != null)
generator.setGenerateImplicitJoinPathsToOne(g.getGenerate().isImplicitJoinPathsToOne());
if (g.getGenerate().isRowConvenienceToOne() != null)
generator.setGenerateRowConvenienceToOne(g.getGenerate().isRowConvenienceToOne());
if (g.getGenerate().isMultisetConvenienceOneToMany() != null)
generator.setGenerateMultisetConvenienceOneToMany(g.getGenerate().isMultisetConvenienceOneToMany());
if (g.getGenerate().isMultisetConvenienceManyToMany() != null)
generator.setGenerateMultisetConvenienceManyToMany(g.getGenerate().isMultisetConvenienceManyToMany());
if (g.getGenerate().isDeprecated() != null)
generator.setGenerateDeprecated(g.getGenerate().isDeprecated());
if (g.getGenerate().isDeprecationOnUnknownTypes() != null)

View File

@ -121,6 +121,42 @@ public interface Generator {
*/
void setGenerateImplicitJoinPathsToOne(boolean generateImplicitJoinPathsToOne);
/**
* Whether <code>ROW</code> convenience syntax for to-one relationships
* should be generated.
*/
boolean generateRowConvenienceToOne();
/**
* Whether <code>ROW</code> convenience syntax for to-one relationships
* should be generated.
*/
void setGenerateRowConvenienceToOne(boolean generateRowConvenienceToOne);
/**
* Whether <code>MULTISET</code> convenience syntax for one-to-many
* relationships should be generated.
*/
boolean generateMultisetConvenienceOneToMany();
/**
* Whether <code>MULTISET</code> convenience syntax for one-to-many
* relationships should be generated.
*/
void setGenerateMultisetConvenienceOneToMany(boolean generateMultisetConvenienceOneToMany);
/**
* Whether <code>MULTISET</code> convenience syntax for many-to-many
* relationships should be generated.
*/
boolean generateMultisetConvenienceManyToMany();
/**
* Whether <code>MULTISET</code> convenience syntax for many-to-many
* relationships should be generated.
*/
void setGenerateMultisetConvenienceManyToMany(boolean generateMultisetConvenienceManyToMany);
/**
* Whether table-valued functions should be generated as tables.
*/

View File

@ -83,13 +83,12 @@ import java.util.Optional;
import java.util.Set;
import java.util.TimeZone;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jakarta.xml.bind.DatatypeConverter;
import org.jooq.AggregateFunction;
import org.jooq.Catalog;
import org.jooq.Check;
@ -117,6 +116,7 @@ import org.jooq.Sequence;
import org.jooq.SortOrder;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UDT;
import org.jooq.UDTField;
@ -187,6 +187,8 @@ import org.jooq.tools.reflect.Reflect;
import org.jooq.tools.reflect.ReflectException;
// ...
import jakarta.xml.bind.DatatypeConverter;
/**
* A default implementation for code generation.
@ -5995,6 +5997,167 @@ public class JavaGenerator extends AbstractGenerator {
}
}
}
}
List<CheckConstraintDefinition> cc = table.getCheckConstraints();

View File

@ -7,6 +7,7 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -14,16 +15,20 @@ import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row4;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Indexes;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.ActorRecord;
import org.jooq.example.testcontainers.db.tables.records.FilmActorRecord;
import org.jooq.example.testcontainers.db.tables.records.FilmRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
@ -123,6 +128,40 @@ public class Actor extends TableImpl<ActorRecord> {
return Keys.ACTOR_PKEY;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film_actor</code> one-to-many child
* table.
*/
public Field<Result<FilmActorRecord>> filmActorMultiset() {
return filmActorMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film_actor</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> filmActorMultiset(Function<? super FilmActor, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.FILM_ACTOR__FILM_ACTOR_ACTOR_ID_FKEY, t -> subquery.apply((FilmActor) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film</code> many-to-many child table.
*/
public Field<Result<FilmRecord>> filmMultiset() {
return filmMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> filmMultiset(Function<? super Film, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.FILM_ACTOR__FILM_ACTOR_ACTOR_ID_FKEY, Keys.FILM_ACTOR__FILM_ACTOR_FILM_ID_FKEY, t -> subquery.apply((Film) t));
}
@Override
public Actor as(String alias) {
return new Actor(DSL.name(alias), this);

View File

@ -7,6 +7,7 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -14,16 +15,21 @@ import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row8;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Indexes;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.AddressRecord;
import org.jooq.example.testcontainers.db.tables.records.CustomerRecord;
import org.jooq.example.testcontainers.db.tables.records.StaffRecord;
import org.jooq.example.testcontainers.db.tables.records.StoreRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
@ -160,6 +166,54 @@ public class Address extends TableImpl<AddressRecord> {
return _city;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.customer</code> one-to-many child table.
*/
public Field<Result<CustomerRecord>> customerMultiset() {
return customerMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.customer</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> customerMultiset(Function<? super Customer, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.CUSTOMER__CUSTOMER_ADDRESS_ID_FKEY, t -> subquery.apply((Customer) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.staff</code> one-to-many child table.
*/
public Field<Result<StaffRecord>> staffMultiset() {
return staffMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.staff</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> staffMultiset(Function<? super Staff, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.STAFF__STAFF_ADDRESS_ID_FKEY, t -> subquery.apply((Staff) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.store</code> one-to-many child table.
*/
public Field<Result<StoreRecord>> storeMultiset() {
return storeMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.store</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> storeMultiset(Function<? super Store, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.STORE__STORE_ADDRESS_ID_FKEY, t -> subquery.apply((Store) t));
}
@Override
public Address as(String alias) {
return new Address(DSL.name(alias), this);

View File

@ -5,21 +5,26 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row3;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.CategoryRecord;
import org.jooq.example.testcontainers.db.tables.records.FilmCategoryRecord;
import org.jooq.example.testcontainers.db.tables.records.FilmRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
@ -109,6 +114,40 @@ public class Category extends TableImpl<CategoryRecord> {
return Keys.CATEGORY_PKEY;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film_category</code> one-to-many child
* table.
*/
public Field<Result<FilmCategoryRecord>> filmCategoryMultiset() {
return filmCategoryMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film_category</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> filmCategoryMultiset(Function<? super FilmCategory, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.FILM_CATEGORY__FILM_CATEGORY_CATEGORY_ID_FKEY, t -> subquery.apply((FilmCategory) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film</code> many-to-many child table.
*/
public Field<Result<FilmRecord>> filmMultiset() {
return filmMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> filmMultiset(Function<? super Film, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.FILM_CATEGORY__FILM_CATEGORY_CATEGORY_ID_FKEY, Keys.FILM_CATEGORY__FILM_CATEGORY_FILM_ID_FKEY, t -> subquery.apply((Film) t));
}
@Override
public Category as(String alias) {
return new Category(DSL.name(alias), this);

View File

@ -7,6 +7,7 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -14,15 +15,18 @@ import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row4;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Indexes;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.AddressRecord;
import org.jooq.example.testcontainers.db.tables.records.CityRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
@ -140,6 +144,22 @@ public class City extends TableImpl<CityRecord> {
return _country;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.address</code> one-to-many child table.
*/
public Field<Result<AddressRecord>> addressMultiset() {
return addressMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.address</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> addressMultiset(Function<? super Address, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.ADDRESS__ADDRESS_CITY_ID_FKEY, t -> subquery.apply((Address) t));
}
@Override
public City as(String alias) {
return new City(DSL.name(alias), this);

View File

@ -5,20 +5,24 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row3;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.CityRecord;
import org.jooq.example.testcontainers.db.tables.records.CountryRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
@ -109,6 +113,22 @@ public class Country extends TableImpl<CountryRecord> {
return Keys.COUNTRY_PKEY;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.city</code> one-to-many child table.
*/
public Field<Result<CityRecord>> cityMultiset() {
return cityMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.city</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> cityMultiset(Function<? super City, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.CITY__CITY_COUNTRY_ID_FKEY, t -> subquery.apply((City) t));
}
@Override
public Country as(String alias) {
return new Country(DSL.name(alias), this);

View File

@ -8,6 +8,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -15,16 +16,26 @@ import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row10;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Indexes;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.CustomerRecord;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_01Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_02Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_03Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_04Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_05Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_06Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentRecord;
import org.jooq.example.testcontainers.db.tables.records.RentalRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
@ -182,6 +193,146 @@ public class Customer extends TableImpl<CustomerRecord> {
return _address;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment</code> one-to-many child table.
*/
public Field<Result<PaymentRecord>> paymentMultiset() {
return paymentMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> paymentMultiset(Function<? super Payment, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT__PAYMENT_CUSTOMER_ID_FKEY, t -> subquery.apply((Payment) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_01</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_01Record>> paymentP2007_01Multiset() {
return paymentP2007_01Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_01</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_01Multiset(Function<? super PaymentP2007_01, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_01__PAYMENT_P2007_01_CUSTOMER_ID_FKEY, t -> subquery.apply((PaymentP2007_01) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_02</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_02Record>> paymentP2007_02Multiset() {
return paymentP2007_02Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_02</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_02Multiset(Function<? super PaymentP2007_02, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_02__PAYMENT_P2007_02_CUSTOMER_ID_FKEY, t -> subquery.apply((PaymentP2007_02) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_03</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_03Record>> paymentP2007_03Multiset() {
return paymentP2007_03Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_03</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_03Multiset(Function<? super PaymentP2007_03, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_03__PAYMENT_P2007_03_CUSTOMER_ID_FKEY, t -> subquery.apply((PaymentP2007_03) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_04</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_04Record>> paymentP2007_04Multiset() {
return paymentP2007_04Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_04</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_04Multiset(Function<? super PaymentP2007_04, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_04__PAYMENT_P2007_04_CUSTOMER_ID_FKEY, t -> subquery.apply((PaymentP2007_04) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_05</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_05Record>> paymentP2007_05Multiset() {
return paymentP2007_05Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_05</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_05Multiset(Function<? super PaymentP2007_05, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_05__PAYMENT_P2007_05_CUSTOMER_ID_FKEY, t -> subquery.apply((PaymentP2007_05) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_06</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_06Record>> paymentP2007_06Multiset() {
return paymentP2007_06Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_06</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_06Multiset(Function<? super PaymentP2007_06, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_06__PAYMENT_P2007_06_CUSTOMER_ID_FKEY, t -> subquery.apply((PaymentP2007_06) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.rental</code> one-to-many child table.
*/
public Field<Result<RentalRecord>> rentalMultiset() {
return rentalMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.rental</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> rentalMultiset(Function<? super Rental, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.RENTAL__RENTAL_CUSTOMER_ID_FKEY, t -> subquery.apply((Rental) t));
}
@Override
public Customer as(String alias) {
return new Customer(DSL.name(alias), this);

View File

@ -8,6 +8,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -15,17 +16,25 @@ import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row14;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Indexes;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.enums.MpaaRating;
import org.jooq.example.testcontainers.db.tables.records.ActorRecord;
import org.jooq.example.testcontainers.db.tables.records.CategoryRecord;
import org.jooq.example.testcontainers.db.tables.records.FilmActorRecord;
import org.jooq.example.testcontainers.db.tables.records.FilmCategoryRecord;
import org.jooq.example.testcontainers.db.tables.records.FilmRecord;
import org.jooq.example.testcontainers.db.tables.records.InventoryRecord;
import org.jooq.example.testcontainers.db.tables.records.StoreRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
@ -211,6 +220,106 @@ public class Film extends TableImpl<FilmRecord> {
return _filmOriginalLanguageIdFkey;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film_actor</code> one-to-many child
* table.
*/
public Field<Result<FilmActorRecord>> filmActorMultiset() {
return filmActorMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film_actor</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> filmActorMultiset(Function<? super FilmActor, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.FILM_ACTOR__FILM_ACTOR_FILM_ID_FKEY, t -> subquery.apply((FilmActor) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film_category</code> one-to-many child
* table.
*/
public Field<Result<FilmCategoryRecord>> filmCategoryMultiset() {
return filmCategoryMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.film_category</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> filmCategoryMultiset(Function<? super FilmCategory, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.FILM_CATEGORY__FILM_CATEGORY_FILM_ID_FKEY, t -> subquery.apply((FilmCategory) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.inventory</code> one-to-many child table.
*/
public Field<Result<InventoryRecord>> inventoryMultiset() {
return inventoryMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.inventory</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> inventoryMultiset(Function<? super Inventory, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.INVENTORY__INVENTORY_FILM_ID_FKEY, t -> subquery.apply((Inventory) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.actor</code> many-to-many child table.
*/
public Field<Result<ActorRecord>> actorMultiset() {
return actorMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.actor</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> actorMultiset(Function<? super Actor, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.FILM_ACTOR__FILM_ACTOR_FILM_ID_FKEY, Keys.FILM_ACTOR__FILM_ACTOR_ACTOR_ID_FKEY, t -> subquery.apply((Actor) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.category</code> many-to-many child table.
*/
public Field<Result<CategoryRecord>> categoryMultiset() {
return categoryMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.category</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> categoryMultiset(Function<? super Category, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.FILM_CATEGORY__FILM_CATEGORY_FILM_ID_FKEY, Keys.FILM_CATEGORY__FILM_CATEGORY_CATEGORY_ID_FKEY, t -> subquery.apply((Category) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.store</code> many-to-many child table.
*/
public Field<Result<StoreRecord>> storeMultiset() {
return storeMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.store</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> storeMultiset(Function<? super Store, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.INVENTORY__INVENTORY_FILM_ID_FKEY, Keys.INVENTORY__INVENTORY_STORE_ID_FKEY, t -> subquery.apply((Store) t));
}
@Override
public Film as(String alias) {
return new Film(DSL.name(alias), this);

View File

@ -7,6 +7,7 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -14,16 +15,21 @@ import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row4;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Indexes;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.CustomerRecord;
import org.jooq.example.testcontainers.db.tables.records.InventoryRecord;
import org.jooq.example.testcontainers.db.tables.records.RentalRecord;
import org.jooq.example.testcontainers.db.tables.records.StaffRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
@ -151,6 +157,54 @@ public class Inventory extends TableImpl<InventoryRecord> {
return _store;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.rental</code> one-to-many child table.
*/
public Field<Result<RentalRecord>> rentalMultiset() {
return rentalMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.rental</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> rentalMultiset(Function<? super Rental, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.RENTAL__RENTAL_INVENTORY_ID_FKEY, t -> subquery.apply((Rental) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.customer</code> many-to-many child table.
*/
public Field<Result<CustomerRecord>> customerMultiset() {
return customerMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.customer</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> customerMultiset(Function<? super Customer, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.RENTAL__RENTAL_INVENTORY_ID_FKEY, Keys.RENTAL__RENTAL_CUSTOMER_ID_FKEY, t -> subquery.apply((Customer) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.staff</code> many-to-many child table.
*/
public Field<Result<StaffRecord>> staffMultiset() {
return staffMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.staff</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> staffMultiset(Function<? super Staff, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.RENTAL__RENTAL_INVENTORY_ID_FKEY, Keys.RENTAL__RENTAL_STAFF_ID_FKEY, t -> subquery.apply((Staff) t));
}
@Override
public Inventory as(String alias) {
return new Inventory(DSL.name(alias), this);

View File

@ -5,16 +5,19 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row3;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Keys;
@ -109,6 +112,38 @@ public class Language extends TableImpl<LanguageRecord> {
return Keys.LANGUAGE_PKEY;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.language</code> many-to-many child table.
*/
public Field<Result<LanguageRecord>> filmOriginalLanguageIdFkeyMultiset() {
return filmOriginalLanguageIdFkeyMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.language</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> filmOriginalLanguageIdFkeyMultiset(Function<? super Language, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.FILM__FILM_LANGUAGE_ID_FKEY, Keys.FILM__FILM_ORIGINAL_LANGUAGE_ID_FKEY, t -> subquery.apply((Language) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.language</code> many-to-many child table.
*/
public Field<Result<LanguageRecord>> filmLanguageIdFkeyMultiset() {
return filmLanguageIdFkeyMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.language</code> many-to-many child table.
*/
public <O extends Record> Field<Result<O>> filmLanguageIdFkeyMultiset(Function<? super Language, ? extends TableLike<O>> subquery) {
return manyToManyMultiset(Keys.FILM__FILM_ORIGINAL_LANGUAGE_ID_FKEY, Keys.FILM__FILM_LANGUAGE_ID_FKEY, t -> subquery.apply((Language) t));
}
@Override
public Language as(String alias) {
return new Language(DSL.name(alias), this);

View File

@ -7,6 +7,7 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -14,15 +15,24 @@ import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row7;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Indexes;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_01Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_02Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_03Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_04Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_05Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_06Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentRecord;
import org.jooq.example.testcontainers.db.tables.records.RentalRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
@ -177,6 +187,130 @@ public class Rental extends TableImpl<RentalRecord> {
return _staff;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment</code> one-to-many child table.
*/
public Field<Result<PaymentRecord>> paymentMultiset() {
return paymentMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> paymentMultiset(Function<? super Payment, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT__PAYMENT_RENTAL_ID_FKEY, t -> subquery.apply((Payment) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_01</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_01Record>> paymentP2007_01Multiset() {
return paymentP2007_01Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_01</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_01Multiset(Function<? super PaymentP2007_01, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_01__PAYMENT_P2007_01_RENTAL_ID_FKEY, t -> subquery.apply((PaymentP2007_01) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_02</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_02Record>> paymentP2007_02Multiset() {
return paymentP2007_02Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_02</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_02Multiset(Function<? super PaymentP2007_02, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_02__PAYMENT_P2007_02_RENTAL_ID_FKEY, t -> subquery.apply((PaymentP2007_02) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_03</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_03Record>> paymentP2007_03Multiset() {
return paymentP2007_03Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_03</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_03Multiset(Function<? super PaymentP2007_03, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_03__PAYMENT_P2007_03_RENTAL_ID_FKEY, t -> subquery.apply((PaymentP2007_03) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_04</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_04Record>> paymentP2007_04Multiset() {
return paymentP2007_04Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_04</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_04Multiset(Function<? super PaymentP2007_04, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_04__PAYMENT_P2007_04_RENTAL_ID_FKEY, t -> subquery.apply((PaymentP2007_04) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_05</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_05Record>> paymentP2007_05Multiset() {
return paymentP2007_05Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_05</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_05Multiset(Function<? super PaymentP2007_05, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_05__PAYMENT_P2007_05_RENTAL_ID_FKEY, t -> subquery.apply((PaymentP2007_05) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_06</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_06Record>> paymentP2007_06Multiset() {
return paymentP2007_06Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_06</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_06Multiset(Function<? super PaymentP2007_06, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_06__PAYMENT_P2007_06_RENTAL_ID_FKEY, t -> subquery.apply((PaymentP2007_06) t));
}
@Override
public Rental as(String alias) {
return new Rental(DSL.name(alias), this);

View File

@ -7,21 +7,33 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row11;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_01Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_02Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_03Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_04Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_05Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentP2007_06Record;
import org.jooq.example.testcontainers.db.tables.records.PaymentRecord;
import org.jooq.example.testcontainers.db.tables.records.RentalRecord;
import org.jooq.example.testcontainers.db.tables.records.StaffRecord;
import org.jooq.example.testcontainers.db.tables.records.StoreRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
@ -179,6 +191,162 @@ public class Staff extends TableImpl<StaffRecord> {
return _store;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment</code> one-to-many child table.
*/
public Field<Result<PaymentRecord>> paymentMultiset() {
return paymentMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> paymentMultiset(Function<? super Payment, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT__PAYMENT_STAFF_ID_FKEY, t -> subquery.apply((Payment) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_01</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_01Record>> paymentP2007_01Multiset() {
return paymentP2007_01Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_01</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_01Multiset(Function<? super PaymentP2007_01, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_01__PAYMENT_P2007_01_STAFF_ID_FKEY, t -> subquery.apply((PaymentP2007_01) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_02</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_02Record>> paymentP2007_02Multiset() {
return paymentP2007_02Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_02</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_02Multiset(Function<? super PaymentP2007_02, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_02__PAYMENT_P2007_02_STAFF_ID_FKEY, t -> subquery.apply((PaymentP2007_02) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_03</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_03Record>> paymentP2007_03Multiset() {
return paymentP2007_03Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_03</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_03Multiset(Function<? super PaymentP2007_03, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_03__PAYMENT_P2007_03_STAFF_ID_FKEY, t -> subquery.apply((PaymentP2007_03) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_04</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_04Record>> paymentP2007_04Multiset() {
return paymentP2007_04Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_04</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_04Multiset(Function<? super PaymentP2007_04, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_04__PAYMENT_P2007_04_STAFF_ID_FKEY, t -> subquery.apply((PaymentP2007_04) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_05</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_05Record>> paymentP2007_05Multiset() {
return paymentP2007_05Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_05</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_05Multiset(Function<? super PaymentP2007_05, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_05__PAYMENT_P2007_05_STAFF_ID_FKEY, t -> subquery.apply((PaymentP2007_05) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_06</code> one-to-many child
* table.
*/
public Field<Result<PaymentP2007_06Record>> paymentP2007_06Multiset() {
return paymentP2007_06Multiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.payment_p2007_06</code> one-to-many child
* table.
*/
public <O extends Record> Field<Result<O>> paymentP2007_06Multiset(Function<? super PaymentP2007_06, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.PAYMENT_P2007_06__PAYMENT_P2007_06_STAFF_ID_FKEY, t -> subquery.apply((PaymentP2007_06) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.rental</code> one-to-many child table.
*/
public Field<Result<RentalRecord>> rentalMultiset() {
return rentalMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.rental</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> rentalMultiset(Function<? super Rental, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.RENTAL__RENTAL_STAFF_ID_FKEY, t -> subquery.apply((Rental) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.store</code> one-to-many child table.
*/
public Field<Result<StoreRecord>> storeMultiset() {
return storeMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.store</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> storeMultiset(Function<? super Store, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.STORE__STORE_MANAGER_STAFF_ID_FKEY, t -> subquery.apply((Store) t));
}
@Override
public Staff as(String alias) {
return new Staff(DSL.name(alias), this);

View File

@ -7,6 +7,7 @@ package org.jooq.example.testcontainers.db.tables;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -14,15 +15,20 @@ import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Result;
import org.jooq.Row4;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.example.testcontainers.db.Indexes;
import org.jooq.example.testcontainers.db.Keys;
import org.jooq.example.testcontainers.db.Public;
import org.jooq.example.testcontainers.db.tables.records.CustomerRecord;
import org.jooq.example.testcontainers.db.tables.records.InventoryRecord;
import org.jooq.example.testcontainers.db.tables.records.StaffRecord;
import org.jooq.example.testcontainers.db.tables.records.StoreRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
@ -151,6 +157,54 @@ public class Store extends TableImpl<StoreRecord> {
return _address;
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.customer</code> one-to-many child table.
*/
public Field<Result<CustomerRecord>> customerMultiset() {
return customerMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.customer</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> customerMultiset(Function<? super Customer, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.CUSTOMER__CUSTOMER_STORE_ID_FKEY, t -> subquery.apply((Customer) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.inventory</code> one-to-many child table.
*/
public Field<Result<InventoryRecord>> inventoryMultiset() {
return inventoryMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.inventory</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> inventoryMultiset(Function<? super Inventory, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.INVENTORY__INVENTORY_STORE_ID_FKEY, t -> subquery.apply((Inventory) t));
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.staff</code> one-to-many child table.
*/
public Field<Result<StaffRecord>> staffMultiset() {
return staffMultiset(Function.identity());
}
/**
* A convenience constructor for correlated <code>MULTISET</code>s
* expressions to the <code>public.staff</code> one-to-many child table.
*/
public <O extends Record> Field<Result<O>> staffMultiset(Function<? super Staff, ? extends TableLike<O>> subquery) {
return oneToManyMultiset(Keys.STAFF__STAFF_STORE_ID_FKEY, t -> subquery.apply((Staff) t));
}
@Override
public Store as(String alias) {
return new Store(DSL.name(alias), this);

View File

@ -1,12 +1,16 @@
package org.jooq.example.test.containers;
import org.jooq.*;
import org.jooq.example.testcontainers.db.Tables;
import org.jooq.impl.DSL;
import org.jooq.tools.JooqLogger;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testcontainers.jdbc.ContainerDatabaseDriver;
import static org.jooq.JSONFormat.RecordFormat.OBJECT;
import static org.jooq.Records.mapping;
import static org.jooq.XMLFormat.RecordFormat.COLUMN_NAME_ELEMENTS;
import static org.jooq.example.testcontainers.db.Tables.FILM;
import static org.jooq.example.testcontainers.db.Tables.FILM_ACTOR;
import static org.jooq.example.testcontainers.db.Tables.FILM_CATEGORY;
import static org.jooq.example.testcontainers.db.Tables.PAYMENT;
import static org.jooq.impl.DSL.multiset;
import static org.jooq.impl.DSL.multisetAgg;
import static org.jooq.impl.DSL.select;
import static org.jooq.impl.DSL.sum;
import java.sql.Connection;
import java.sql.SQLException;
@ -14,11 +18,19 @@ import java.sql.Statement;
import java.util.Arrays;
import java.util.Properties;
import static org.jooq.JSONFormat.RecordFormat.OBJECT;
import static org.jooq.Records.mapping;
import static org.jooq.XMLFormat.RecordFormat.COLUMN_NAME_ELEMENTS;
import static org.jooq.example.testcontainers.db.Tables.*;
import static org.jooq.impl.DSL.*;
import org.jooq.DSLContext;
import org.jooq.JSONFormat;
import org.jooq.Result;
import org.jooq.SQLDialect;
import org.jooq.Source;
import org.jooq.TXTFormat;
import org.jooq.XMLFormat;
import org.jooq.impl.DSL;
import org.jooq.tools.JooqLogger;
import org.junit.BeforeClass;
import org.junit.Test;
import org.testcontainers.jdbc.ContainerDatabaseDriver;
public class TestContainersTest {

View File

@ -39,6 +39,12 @@ public class Generate implements Serializable, XMLAppendable
@XmlElement(defaultValue = "true")
protected Boolean implicitJoinPathsToOne = true;
@XmlElement(defaultValue = "true")
protected Boolean rowConvenienceToOne = true;
@XmlElement(defaultValue = "true")
protected Boolean multisetConvenienceOneToMany = true;
@XmlElement(defaultValue = "true")
protected Boolean multisetConvenienceManyToMany = true;
@XmlElement(defaultValue = "true")
protected Boolean deprecated = true;
@XmlElement(defaultValue = "true")
protected Boolean deprecationOnUnknownTypes = true;
@ -311,6 +317,84 @@ public class Generate implements Serializable, XMLAppendable
this.implicitJoinPathsToOne = value;
}
/**
* Generate <code>ROW</code> convenience syntax for to-one relationships.
* <p>
* This feature is available in the commercial distribution only.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isRowConvenienceToOne() {
return rowConvenienceToOne;
}
/**
* Sets the value of the rowConvenienceToOne property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setRowConvenienceToOne(Boolean value) {
this.rowConvenienceToOne = value;
}
/**
* Generate <code>MULTISET</code> convenience syntax for one-to-many relationships.
* <p>
* This feature is available in the commercial distribution only.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isMultisetConvenienceOneToMany() {
return multisetConvenienceOneToMany;
}
/**
* Sets the value of the multisetConvenienceOneToMany property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setMultisetConvenienceOneToMany(Boolean value) {
this.multisetConvenienceOneToMany = value;
}
/**
* Generate <code>MULTISET</code> convenience syntax for many-to-many relationships. A many-to-many relationship is achieved when a child table has 2 non-nullable foreign keys that are part of a unique key.
* <p>
* This feature is available in the commercial distribution only.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isMultisetConvenienceManyToMany() {
return multisetConvenienceManyToMany;
}
/**
* Sets the value of the multisetConvenienceManyToMany property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setMultisetConvenienceManyToMany(Boolean value) {
this.multisetConvenienceManyToMany = value;
}
/**
* Generate deprecated code for backwards compatibility
*
@ -2322,6 +2406,21 @@ public class Generate implements Serializable, XMLAppendable
return this;
}
public Generate withRowConvenienceToOne(Boolean value) {
setRowConvenienceToOne(value);
return this;
}
public Generate withMultisetConvenienceOneToMany(Boolean value) {
setMultisetConvenienceOneToMany(value);
return this;
}
public Generate withMultisetConvenienceManyToMany(Boolean value) {
setMultisetConvenienceManyToMany(value);
return this;
}
public Generate withDeprecated(Boolean value) {
setDeprecated(value);
return this;
@ -2802,6 +2901,9 @@ public class Generate implements Serializable, XMLAppendable
builder.append("relations", relations);
builder.append("sequenceFlags", sequenceFlags);
builder.append("implicitJoinPathsToOne", implicitJoinPathsToOne);
builder.append("rowConvenienceToOne", rowConvenienceToOne);
builder.append("multisetConvenienceOneToMany", multisetConvenienceOneToMany);
builder.append("multisetConvenienceManyToMany", multisetConvenienceManyToMany);
builder.append("deprecated", deprecated);
builder.append("deprecationOnUnknownTypes", deprecationOnUnknownTypes);
builder.append("instanceFields", instanceFields);
@ -2944,6 +3046,33 @@ public class Generate implements Serializable, XMLAppendable
return false;
}
}
if (rowConvenienceToOne == null) {
if (other.rowConvenienceToOne!= null) {
return false;
}
} else {
if (!rowConvenienceToOne.equals(other.rowConvenienceToOne)) {
return false;
}
}
if (multisetConvenienceOneToMany == null) {
if (other.multisetConvenienceOneToMany!= null) {
return false;
}
} else {
if (!multisetConvenienceOneToMany.equals(other.multisetConvenienceOneToMany)) {
return false;
}
}
if (multisetConvenienceManyToMany == null) {
if (other.multisetConvenienceManyToMany!= null) {
return false;
}
} else {
if (!multisetConvenienceManyToMany.equals(other.multisetConvenienceManyToMany)) {
return false;
}
}
if (deprecated == null) {
if (other.deprecated!= null) {
return false;
@ -3720,6 +3849,9 @@ public class Generate implements Serializable, XMLAppendable
result = ((prime*result)+((relations == null)? 0 :relations.hashCode()));
result = ((prime*result)+((sequenceFlags == null)? 0 :sequenceFlags.hashCode()));
result = ((prime*result)+((implicitJoinPathsToOne == null)? 0 :implicitJoinPathsToOne.hashCode()));
result = ((prime*result)+((rowConvenienceToOne == null)? 0 :rowConvenienceToOne.hashCode()));
result = ((prime*result)+((multisetConvenienceOneToMany == null)? 0 :multisetConvenienceOneToMany.hashCode()));
result = ((prime*result)+((multisetConvenienceManyToMany == null)? 0 :multisetConvenienceManyToMany.hashCode()));
result = ((prime*result)+((deprecated == null)? 0 :deprecated.hashCode()));
result = ((prime*result)+((deprecationOnUnknownTypes == null)? 0 :deprecationOnUnknownTypes.hashCode()));
result = ((prime*result)+((instanceFields == null)? 0 :instanceFields.hashCode()));

View File

@ -1582,6 +1582,24 @@ This is a prerequisite for various advanced features]]></jxb:javadoc></jxb:prope
<element name="implicitJoinPathsToOne" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate implicit join path constructors on generated tables for outgoing foreign key relationships (to-one relationships)]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="rowConvenienceToOne" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate <code>ROW</code> convenience syntax for to-one relationships.
<p>
This feature is available in the commercial distribution only.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="multisetConvenienceOneToMany" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate <code>MULTISET</code> convenience syntax for one-to-many relationships.
<p>
This feature is available in the commercial distribution only.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="multisetConvenienceManyToMany" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate <code>MULTISET</code> convenience syntax for many-to-many relationships. A many-to-many relationship is achieved when a child table has 2 non-nullable foreign keys that are part of a unique key.
<p>
This feature is available in the commercial distribution only.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="deprecated" type="boolean" default="true" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Generate deprecated code for backwards compatibility]]></jxb:javadoc></jxb:property></appinfo></annotation>

View File

@ -45,45 +45,62 @@ import static org.jooq.Clause.TABLE_REFERENCE;
// ...
// ...
// ...
// ...
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.H2;
import static org.jooq.SQLDialect.HSQLDB;
// ...
import static org.jooq.SQLDialect.MARIADB;
import static org.jooq.SQLDialect.MYSQL;
// ...
// ...
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.SQLDialect.YUGABYTEDB;
import static org.jooq.impl.DSL.and;
import static org.jooq.impl.DSL.multiset;
import static org.jooq.impl.DSL.multisetAgg;
import static org.jooq.impl.DSL.row;
import static org.jooq.impl.DSL.select;
import static org.jooq.impl.DSL.selectFrom;
import static org.jooq.impl.DefaultMetaProvider.meta;
import static org.jooq.impl.Internal.createPathAlias;
import static org.jooq.impl.Keywords.K_TABLE;
import static org.jooq.impl.Names.N_MULTISET;
import static org.jooq.impl.QueryPartListView.wrap;
import static org.jooq.impl.SchemaImpl.DEFAULT_SCHEMA;
import static org.jooq.impl.Tools.EMPTY_OBJECT;
import static org.jooq.impl.Tools.getMappedTable;
import static org.jooq.tools.StringUtils.defaultIfNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Predicate;
import java.util.function.Function;
import java.util.stream.Stream;
import org.jooq.Clause;
import org.jooq.Comment;
import org.jooq.Condition;
import org.jooq.Context;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function1;
import org.jooq.Name;
// ...
import org.jooq.QueryPart;
import org.jooq.Record;
// ...
import org.jooq.Result;
import org.jooq.Row;
import org.jooq.SQLDialect;
import org.jooq.Schema;
import org.jooq.Select;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableLike;
import org.jooq.TableOptions;
// ...
import org.jooq.impl.QOM.UEmptyField;
import org.jooq.impl.QOM.UNotYetImplemented;
import org.jooq.tools.StringUtils;
@ -252,6 +269,121 @@ implements
return null;
}
/**
* Check if this table already aliases another one.
* <p>