-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning generated and embedded case classes #2725
Comments
A bit more information regarding this issue in case anyone with a bit more knowledge would happens to read that. As of now what I was able to track down is that the Looking down in the So my guess is that there is something wrong when mixing embedded case classes and external mapping, we only unpack the Opinionated part but do not consider the inner https://github.com/zio/zio-quill/blob/master/quill-engine/src/main/scala/io/getquill/sql/idiom/SqlIdiom.scala#L430 Action SQL:
| ReturningGenerated(
| Insert(
| Entity("ReturnedProduct", List(PropertyAlias(List("product", "id"), "id"))),
| List(
| Assignment(
| Id("v"),
| v.returnedDate,
| ScalarValueLift(
| "Ex 5 insert.returning(_.subClass.generatedColumn) mod.this.returnedProduct.returnedDate",
| UnparsedProperty("Ex 5 insert.returning(_.subClass.generatedColumn) mod.this.returnedProduct.returnedDate")
| )
| ),
| Assignment(
| Id("v"),
| v.product.description,
| ScalarValueLift(
| "Ex 5 insert.returning(_.subClass.generatedColumn) mod.this.returnedProduct.product.description",
| UnparsedProperty("Ex 5 insert.returning(_.subClass.generatedColumn) mod.this.returnedProduct.product.description")
| )
| ),
| Assignment(
| Id("v"),
| v.product.sku,
| ScalarValueLift(
| "Ex 5 insert.returning(_.subClass.generatedColumn) mod.this.returnedProduct.product.sku",
| UnparsedProperty("Ex 5 insert.returning(_.subClass.generatedColumn) mod.this.returnedProduct.product.sku")
| )
| )
| )
| ),
| Id("x11"),
| x11.product.`id`
| ) |
This template isn't a strict requirement to open issues, but please try to provide as much information as possible.
Version: 4.6.0
Module: quill-jdbc
Database: oracle, h2
Scala: 2.13.10
Expected behavior
A query using embedded case classes and
returningGenerated
used to work in 4.4.1, it does not anymore (4.6.0).I was able to reproduce the issue within quill, and the commit can be found https://github.com/ex0ns/zio-quill/commit/648923770451de743be9711e77b0382b450ed1a0
The tests fails with
It seems that somehow the name of the embedded case class get prefixed
product
in this case, in front of the column.I have also tested with a SchemaMeta and/or UpdateMeta, and
product
always get prefixed, even if I explicitly set a mapping.Actual behavior
It should return the generated id of an embedded case class
Steps to reproduce the behavior
This commit contains the changes to reproduce
https://github.com/ex0ns/zio-quill/commit/648923770451de743be9711e77b0382b450ed1a0
Workaround
@getquill/maintainers
The text was updated successfully, but these errors were encountered: