Skip to content
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

Warning about embedding fields that should have encoders #2610

Merged
merged 1 commit into from Sep 28, 2022

Conversation

deusaquilus
Copy link
Collaborator

One significant problem occurs with auto-embedded changes introduced in #2607
In cases where you have a single-value case class inside an entity it will become embedded so it is confusing why the column of the outer entity will be replaced when the inner one is missing an encoder. For example:

case class MyIdType(value: String)
case class Person(id: MyIdType, name: String)
run(query[Person])
// SELECT x.value /*instead of x.id*/, x.name FROM Person x,

Since MyIdType is being treated as an embedded entity, it is automatically embedded and it's value field is being used as the column instead of id. Once the encoder for MyIdType is written this problem will go away. Need to warn the user in cases where the embedded entity has one field that this is likely a column that needs to be embedded.

@deusaquilus deusaquilus merged commit 332152a into master Sep 28, 2022
@deusaquilus deusaquilus deleted the branches-help branch September 28, 2022 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant