I want to insert rows in 2 tables which represent a 1:n relationship using scalaquery / slick.
The tables are defined as follows:
object CompanyBaseTable extends Table[CompanyBaseTableEntry]("company") {
def id = column[Int]("id", O PrimaryKey, O AutoInc)
}
object ProductCatalogueTable extends Table[ProductCatalogueEntry]("product_catalogue") {
def cid = column[Int]("id", O NotNull)
def pid = column[Long]("pid", O NotNull)
def company = foreignKey("company_fk", cid, CompanyBaseTable)(_.id)
}
I want to insert the 1:n relation within one transaction but I don't know how I can achieve that using ScalaQuery. In JDBC 3 you can get the generated ID from the statement, but I don't see where the statement is exposed in the ScalaQuery API, neither do I see a way to access this information directly.