Skip to content

Commit

Permalink
[#10] [jOOQ/jOOQ#16037] Generate to-many paths also in Scala demo
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaseder committed Jan 15, 2024
1 parent cf744c5 commit a6c71f0
Show file tree
Hide file tree
Showing 80 changed files with 1,022 additions and 180 deletions.
5 changes: 0 additions & 5 deletions jOOQ-demo-oss/jOOQ-demo-scala/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@
https://www.jooq.org/doc/latest/manual/code-generation/codegen-version-control/ -->
<directory>src/main/scala</directory>
</target>

<generate>
<!-- See: https://github.com/jOOQ/jOOQ/issues/16037 -->
<implicitJoinPathsToMany>false</implicitJoinPathsToMany>
</generate>
</generator>
</configuration>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import org.jooq.UniqueKey
import org.jooq.demo.skala.db.Indexes
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.tables.Film.FilmPath
import org.jooq.demo.skala.db.tables.FilmActor.FilmActorPath
import org.jooq.demo.skala.db.tables.records.ActorRecord
import org.jooq.impl.DSL
import org.jooq.impl.Internal
Expand Down Expand Up @@ -133,6 +135,18 @@ extends TableImpl[ActorRecord](
override def getIdentity: Identity[ActorRecord, Long] = super.getIdentity.asInstanceOf[ Identity[ActorRecord, Long] ]

override def getPrimaryKey: UniqueKey[ActorRecord] = Keys.ACTOR_PKEY

/**
* Get the implicit to-many join path to the <code>public.film_actor</code>
* table
*/
lazy val filmActor: FilmActorPath = { new FilmActorPath(this, null, Keys.FILM_ACTOR__FILM_ACTOR_ACTOR_ID_FKEY.getInverseKey()) }

/**
* Get the implicit many-to-many join path to the <code>public.film</code>
* table
*/
def film: FilmPath = filmActor.film
override def as(alias: String): Actor = new Actor(DSL.name(alias), this)
override def as(alias: Name): Actor = new Actor(alias, this)
override def as(alias: Table[_]): Actor = new Actor(alias.getQualifiedName(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ import org.jooq.demo.skala.db.Indexes
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.tables.City.CityPath
import org.jooq.demo.skala.db.tables.Customer.CustomerPath
import org.jooq.demo.skala.db.tables.Staff.StaffPath
import org.jooq.demo.skala.db.tables.Store.StorePath
import org.jooq.demo.skala.db.tables.records.AddressRecord
import org.jooq.impl.DSL
import org.jooq.impl.Internal
Expand Down Expand Up @@ -161,6 +164,22 @@ extends TableImpl[AddressRecord](
* Get the implicit join path to the <code>public.city</code> table.
*/
lazy val city: CityPath = { new CityPath(this, Keys.ADDRESS__ADDRESS_CITY_ID_FKEY, null) }

/**
* Get the implicit to-many join path to the <code>public.customer</code>
* table
*/
lazy val customer: CustomerPath = { new CustomerPath(this, null, Keys.CUSTOMER__CUSTOMER_ADDRESS_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the <code>public.staff</code> table
*/
lazy val staff: StaffPath = { new StaffPath(this, null, Keys.STAFF__STAFF_ADDRESS_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the <code>public.store</code> table
*/
lazy val store: StorePath = { new StorePath(this, null, Keys.STORE__STORE_ADDRESS_ID_FKEY.getInverseKey()) }
override def as(alias: String): Address = new Address(DSL.name(alias), this)
override def as(alias: Name): Address = new Address(alias, this)
override def as(alias: Table[_]): Address = new Address(alias.getQualifiedName(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import org.jooq.TableOptions
import org.jooq.UniqueKey
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.tables.Film.FilmPath
import org.jooq.demo.skala.db.tables.FilmCategory.FilmCategoryPath
import org.jooq.demo.skala.db.tables.records.CategoryRecord
import org.jooq.impl.DSL
import org.jooq.impl.Internal
Expand Down Expand Up @@ -122,6 +124,18 @@ extends TableImpl[CategoryRecord](
override def getIdentity: Identity[CategoryRecord, Long] = super.getIdentity.asInstanceOf[ Identity[CategoryRecord, Long] ]

override def getPrimaryKey: UniqueKey[CategoryRecord] = Keys.CATEGORY_PKEY

/**
* Get the implicit to-many join path to the <code>public.film_category</code>
* table
*/
lazy val filmCategory: FilmCategoryPath = { new FilmCategoryPath(this, null, Keys.FILM_CATEGORY__FILM_CATEGORY_CATEGORY_ID_FKEY.getInverseKey()) }

/**
* Get the implicit many-to-many join path to the <code>public.film</code>
* table
*/
def film: FilmPath = filmCategory.film
override def as(alias: String): Category = new Category(DSL.name(alias), this)
override def as(alias: Name): Category = new Category(alias, this)
override def as(alias: Table[_]): Category = new Category(alias.getQualifiedName(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.jooq.UniqueKey
import org.jooq.demo.skala.db.Indexes
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.tables.Address.AddressPath
import org.jooq.demo.skala.db.tables.Country.CountryPath
import org.jooq.demo.skala.db.tables.records.CityRecord
import org.jooq.impl.DSL
Expand Down Expand Up @@ -141,6 +142,11 @@ extends TableImpl[CityRecord](
* Get the implicit join path to the <code>public.country</code> table.
*/
lazy val country: CountryPath = { new CountryPath(this, Keys.CITY__CITY_COUNTRY_ID_FKEY, null) }

/**
* Get the implicit to-many join path to the <code>public.address</code> table
*/
lazy val address: AddressPath = { new AddressPath(this, null, Keys.ADDRESS__ADDRESS_CITY_ID_FKEY.getInverseKey()) }
override def as(alias: String): City = new City(DSL.name(alias), this)
override def as(alias: Name): City = new City(alias, this)
override def as(alias: Table[_]): City = new City(alias.getQualifiedName(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.jooq.TableOptions
import org.jooq.UniqueKey
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.tables.City.CityPath
import org.jooq.demo.skala.db.tables.records.CountryRecord
import org.jooq.impl.DSL
import org.jooq.impl.Internal
Expand Down Expand Up @@ -122,6 +123,11 @@ extends TableImpl[CountryRecord](
override def getIdentity: Identity[CountryRecord, Long] = super.getIdentity.asInstanceOf[ Identity[CountryRecord, Long] ]

override def getPrimaryKey: UniqueKey[CountryRecord] = Keys.COUNTRY_PKEY

/**
* Get the implicit to-many join path to the <code>public.city</code> table
*/
lazy val city: CityPath = { new CityPath(this, null, Keys.CITY__CITY_COUNTRY_ID_FKEY.getInverseKey()) }
override def as(alias: String): Country = new Country(DSL.name(alias), this)
override def as(alias: Name): Country = new Country(alias, this)
override def as(alias: Table[_]): Country = new Country(alias.getQualifiedName(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ import org.jooq.demo.skala.db.Indexes
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.tables.Address.AddressPath
import org.jooq.demo.skala.db.tables.Payment.PaymentPath
import org.jooq.demo.skala.db.tables.PaymentP2007_01.PaymentP2007_01Path
import org.jooq.demo.skala.db.tables.PaymentP2007_02.PaymentP2007_02Path
import org.jooq.demo.skala.db.tables.PaymentP2007_03.PaymentP2007_03Path
import org.jooq.demo.skala.db.tables.PaymentP2007_04.PaymentP2007_04Path
import org.jooq.demo.skala.db.tables.PaymentP2007_05.PaymentP2007_05Path
import org.jooq.demo.skala.db.tables.PaymentP2007_06.PaymentP2007_06Path
import org.jooq.demo.skala.db.tables.Rental.RentalPath
import org.jooq.demo.skala.db.tables.Store.StorePath
import org.jooq.demo.skala.db.tables.records.CustomerRecord
import org.jooq.impl.DSL
Expand Down Expand Up @@ -179,6 +187,52 @@ extends TableImpl[CustomerRecord](
* Get the implicit join path to the <code>public.address</code> table.
*/
lazy val address: AddressPath = { new AddressPath(this, Keys.CUSTOMER__CUSTOMER_ADDRESS_ID_FKEY, null) }

/**
* Get the implicit to-many join path to the <code>public.payment</code> table
*/
lazy val payment: PaymentPath = { new PaymentPath(this, null, Keys.PAYMENT__PAYMENT_CUSTOMER_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the
* <code>public.payment_p2007_01</code> table
*/
lazy val paymentP2007_01: PaymentP2007_01Path = { new PaymentP2007_01Path(this, null, Keys.PAYMENT_P2007_01__PAYMENT_P2007_01_CUSTOMER_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the
* <code>public.payment_p2007_02</code> table
*/
lazy val paymentP2007_02: PaymentP2007_02Path = { new PaymentP2007_02Path(this, null, Keys.PAYMENT_P2007_02__PAYMENT_P2007_02_CUSTOMER_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the
* <code>public.payment_p2007_03</code> table
*/
lazy val paymentP2007_03: PaymentP2007_03Path = { new PaymentP2007_03Path(this, null, Keys.PAYMENT_P2007_03__PAYMENT_P2007_03_CUSTOMER_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the
* <code>public.payment_p2007_04</code> table
*/
lazy val paymentP2007_04: PaymentP2007_04Path = { new PaymentP2007_04Path(this, null, Keys.PAYMENT_P2007_04__PAYMENT_P2007_04_CUSTOMER_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the
* <code>public.payment_p2007_05</code> table
*/
lazy val paymentP2007_05: PaymentP2007_05Path = { new PaymentP2007_05Path(this, null, Keys.PAYMENT_P2007_05__PAYMENT_P2007_05_CUSTOMER_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the
* <code>public.payment_p2007_06</code> table
*/
lazy val paymentP2007_06: PaymentP2007_06Path = { new PaymentP2007_06Path(this, null, Keys.PAYMENT_P2007_06__PAYMENT_P2007_06_CUSTOMER_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the <code>public.rental</code> table
*/
lazy val rental: RentalPath = { new RentalPath(this, null, Keys.RENTAL__RENTAL_CUSTOMER_ID_FKEY.getInverseKey()) }
override def as(alias: String): Customer = new Customer(DSL.name(alias), this)
override def as(alias: Name): Customer = new Customer(alias, this)
override def as(alias: Table[_]): Customer = new Customer(alias.getQualifiedName(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ import org.jooq.demo.skala.db.Indexes
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.enums.MpaaRating
import org.jooq.demo.skala.db.tables.Actor.ActorPath
import org.jooq.demo.skala.db.tables.Category.CategoryPath
import org.jooq.demo.skala.db.tables.FilmActor.FilmActorPath
import org.jooq.demo.skala.db.tables.FilmCategory.FilmCategoryPath
import org.jooq.demo.skala.db.tables.Inventory.InventoryPath
import org.jooq.demo.skala.db.tables.Language.LanguagePath
import org.jooq.demo.skala.db.tables.records.FilmRecord
import org.jooq.impl.DSL
Expand Down Expand Up @@ -211,6 +216,36 @@ extends TableImpl[FilmRecord](
* the <code>film_original_language_id_fkey</code> key.
*/
lazy val filmOriginalLanguageIdFkey: LanguagePath = { new LanguagePath(this, Keys.FILM__FILM_ORIGINAL_LANGUAGE_ID_FKEY, null) }

/**
* Get the implicit to-many join path to the <code>public.film_actor</code>
* table
*/
lazy val filmActor: FilmActorPath = { new FilmActorPath(this, null, Keys.FILM_ACTOR__FILM_ACTOR_FILM_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the <code>public.film_category</code>
* table
*/
lazy val filmCategory: FilmCategoryPath = { new FilmCategoryPath(this, null, Keys.FILM_CATEGORY__FILM_CATEGORY_FILM_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the <code>public.inventory</code>
* table
*/
lazy val inventory: InventoryPath = { new InventoryPath(this, null, Keys.INVENTORY__INVENTORY_FILM_ID_FKEY.getInverseKey()) }

/**
* Get the implicit many-to-many join path to the <code>public.actor</code>
* table
*/
def actor: ActorPath = filmActor.actor

/**
* Get the implicit many-to-many join path to the <code>public.category</code>
* table
*/
def category: CategoryPath = filmCategory.category
override def as(alias: String): Film = new Film(DSL.name(alias), this)
override def as(alias: Name): Film = new Film(alias, this)
override def as(alias: Table[_]): Film = new Film(alias.getQualifiedName(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.jooq.ForeignKey
import org.jooq.Index
import org.jooq.InverseForeignKey
import org.jooq.Name
import org.jooq.Path
import org.jooq.PlainSQL
import org.jooq.Record
import org.jooq.SQL
Expand All @@ -36,6 +37,7 @@ import org.jooq.demo.skala.db.tables.Actor.ActorPath
import org.jooq.demo.skala.db.tables.Film.FilmPath
import org.jooq.demo.skala.db.tables.records.FilmActorRecord
import org.jooq.impl.DSL
import org.jooq.impl.Internal
import org.jooq.impl.SQLDataType
import org.jooq.impl.TableImpl

Expand All @@ -48,6 +50,11 @@ object FilmActor {
* The reference instance of <code>public.film_actor</code>
*/
val FILM_ACTOR = new FilmActor

/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
class FilmActorPath(path: Table[_ <: Record], childPath: ForeignKey[_ <: Record, FilmActorRecord], parentPath: InverseForeignKey[_ <: Record, FilmActorRecord]) extends FilmActor(path, childPath, parentPath) with Path[FilmActorRecord]
}

/**
Expand Down Expand Up @@ -113,6 +120,8 @@ extends TableImpl[FilmActorRecord](
*/
def this() = this(DSL.name("film_actor"), null)

def this(path: Table[_ <: Record], childPath: ForeignKey[_ <: Record, FilmActorRecord], parentPath: InverseForeignKey[_ <: Record, FilmActorRecord]) = this(Internal.createPathAlias(path, childPath, parentPath), path, childPath, parentPath, org.jooq.demo.skala.db.tables.FilmActor.FILM_ACTOR, null, null)

override def getSchema: Schema = if (super.aliased()) null else Public.PUBLIC

override def getIndexes: List[Index] = Arrays.asList[ Index ](Indexes.IDX_FK_FILM_ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.jooq.Field
import org.jooq.ForeignKey
import org.jooq.InverseForeignKey
import org.jooq.Name
import org.jooq.Path
import org.jooq.PlainSQL
import org.jooq.Record
import org.jooq.SQL
Expand All @@ -34,6 +35,7 @@ import org.jooq.demo.skala.db.tables.Category.CategoryPath
import org.jooq.demo.skala.db.tables.Film.FilmPath
import org.jooq.demo.skala.db.tables.records.FilmCategoryRecord
import org.jooq.impl.DSL
import org.jooq.impl.Internal
import org.jooq.impl.SQLDataType
import org.jooq.impl.TableImpl

Expand All @@ -46,6 +48,11 @@ object FilmCategory {
* The reference instance of <code>public.film_category</code>
*/
val FILM_CATEGORY = new FilmCategory

/**
* A subtype implementing {@link Path} for simplified path-based joins.
*/
class FilmCategoryPath(path: Table[_ <: Record], childPath: ForeignKey[_ <: Record, FilmCategoryRecord], parentPath: InverseForeignKey[_ <: Record, FilmCategoryRecord]) extends FilmCategory(path, childPath, parentPath) with Path[FilmCategoryRecord]
}

/**
Expand Down Expand Up @@ -111,6 +118,8 @@ extends TableImpl[FilmCategoryRecord](
*/
def this() = this(DSL.name("film_category"), null)

def this(path: Table[_ <: Record], childPath: ForeignKey[_ <: Record, FilmCategoryRecord], parentPath: InverseForeignKey[_ <: Record, FilmCategoryRecord]) = this(Internal.createPathAlias(path, childPath, parentPath), path, childPath, parentPath, org.jooq.demo.skala.db.tables.FilmCategory.FILM_CATEGORY, null, null)

override def getSchema: Schema = if (super.aliased()) null else Public.PUBLIC

override def getPrimaryKey: UniqueKey[FilmCategoryRecord] = Keys.FILM_CATEGORY_PKEY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import org.jooq.demo.skala.db.Indexes
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.tables.Film.FilmPath
import org.jooq.demo.skala.db.tables.Rental.RentalPath
import org.jooq.demo.skala.db.tables.Store.StorePath
import org.jooq.demo.skala.db.tables.records.InventoryRecord
import org.jooq.impl.DSL
Expand Down Expand Up @@ -147,6 +148,11 @@ extends TableImpl[InventoryRecord](
* Get the implicit join path to the <code>public.store</code> table.
*/
lazy val store: StorePath = { new StorePath(this, Keys.INVENTORY__INVENTORY_STORE_ID_FKEY, null) }

/**
* Get the implicit to-many join path to the <code>public.rental</code> table
*/
lazy val rental: RentalPath = { new RentalPath(this, null, Keys.RENTAL__RENTAL_INVENTORY_ID_FKEY.getInverseKey()) }
override def as(alias: String): Inventory = new Inventory(DSL.name(alias), this)
override def as(alias: Name): Inventory = new Inventory(alias, this)
override def as(alias: Table[_]): Inventory = new Inventory(alias.getQualifiedName(), this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.jooq.TableOptions
import org.jooq.UniqueKey
import org.jooq.demo.skala.db.Keys
import org.jooq.demo.skala.db.Public
import org.jooq.demo.skala.db.tables.Film.FilmPath
import org.jooq.demo.skala.db.tables.records.LanguageRecord
import org.jooq.impl.DSL
import org.jooq.impl.Internal
Expand Down Expand Up @@ -122,6 +123,18 @@ extends TableImpl[LanguageRecord](
override def getIdentity: Identity[LanguageRecord, Long] = super.getIdentity.asInstanceOf[ Identity[LanguageRecord, Long] ]

override def getPrimaryKey: UniqueKey[LanguageRecord] = Keys.LANGUAGE_PKEY

/**
* Get the implicit to-many join path to the <code>public.film</code> table,
* via the <code>film_language_id_fkey</code> key
*/
lazy val filmLanguageIdFkey: FilmPath = { new FilmPath(this, null, Keys.FILM__FILM_LANGUAGE_ID_FKEY.getInverseKey()) }

/**
* Get the implicit to-many join path to the <code>public.film</code> table,
* via the <code>film_original_language_id_fkey</code> key
*/
lazy val filmOriginalLanguageIdFkey: FilmPath = { new FilmPath(this, null, Keys.FILM__FILM_ORIGINAL_LANGUAGE_ID_FKEY.getInverseKey()) }
override def as(alias: String): Language = new Language(DSL.name(alias), this)
override def as(alias: Name): Language = new Language(alias, this)
override def as(alias: Table[_]): Language = new Language(alias.getQualifiedName(), this)
Expand Down
Loading

0 comments on commit a6c71f0

Please sign in to comment.