-
Notifications
You must be signed in to change notification settings - Fork 667
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
Exposed Entitys dont support "Composite Primary Key" #1533
Comments
Hello, would like to double check if there's any updates on this issue or any recommended workarounds from the team? In the previous versions I was able to use composite PKs like this: object CarHasWheelsTable : Table(name = "car_has_wheels") {
val carId = reference(name = "car_id", foreign = CarTable)
val wheelId = reference(name = "wheel_id", foreign = WheelTable)
override val primaryKey = PrimaryKey(carId, wheelId)
} But with Exposed 50.0, the following exception is thrown:
I see that @bog-walk has self-assigned this issue, which makes me think this being worked on? However, it would be great to get some guidance on how to deal with cases like that in the current version of Exposed. Thank you! |
Hi @wissil Yes, the composite PK feature is currently in progress and we are reviewing potential designs. Here's the YouTrack issue EXPOSED-77 to track if you're interested. Based on your example, the exception you're seeing is most likely due to a bug from the recent type safety changes. This was already caught and fixed in PR #2074 (EXPOSED-371). If this doesn't work or you don't believe that the linked issue is related to your use case, please consider opening a new issue on YouTrack with more details so we can investigate further. |
ORT has upgraded to Exposed 0.50.0 which has a bug [1] that prevents using it in the server. Fix the Exposed version to 0.49.0 until the fix [2] has been released. [1]: JetBrains/Exposed#1533 (comment) [2]: JetBrains/Exposed#2074
ORT has upgraded to Exposed 0.50.0 which has a bug [1] that prevents using it in the server. Fix the Exposed version to 0.49.0 until the fix [2] has been released. [1]: JetBrains/Exposed#1533 (comment) [2]: JetBrains/Exposed#2074
Hi, thank you! Yes, that indeed looks like it is going to fix the issue we have. I'll wait for when this is released and try it out. |
@wissil Version 0.50.1 has been released with the mentioned fix. |
I'm not a convenient user of Kotlin and I'm more the java dude.
But I started using Exposed for my new project and encountered an issue. While planning my project (and my databases) I thought I could use (as I know them from SQL) Composite Primary Keys so I can (for example) save for a value each day a specific value.
While coding the project I wrote for each table an Entity (DAO) so I could use them easily without dealing with SQL or expressions for selecting and inserting into the database. When I tried to build a table with a Composite Primary Key, I found that there seems no way to use (DAO). This would be a great addition to Exposed I think.
Greeting from Germany
That is the table I want to create a Entity for:
The text was updated successfully, but these errors were encountered: