-
Notifications
You must be signed in to change notification settings - Fork 55
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
Fix: add support for Kotlin data classes without PersistenceConstructor #37
Fix: add support for Kotlin data classes without PersistenceConstructor #37
Conversation
Tests are failing... |
Oops, I only tested it in my own project. I'll check it. |
Okay, so this was a bit of a puzzle. This is how Spring Data resolves constructors:
(taken from reference docs) With this logic now in place, there were two problems with
|
Tests pass and I agree with your reasoning and conclusion. I don't remember exactly why I implemented it the way I did other than for no arg entities support - I assume it's lack of time to research the underlying logic at the time. |
Cool, thanks! This allows me to use plain data classes in Kotlin without I might have another contribution, I will look into it anytime soon. |
FYI, 6.1.1 has been released. |
Thanks for contributing. :) |
When using a Kotlin data class without
PersistenceConstructor
, it picks the incorrect internal Kotlin constructor which leads to errors.This improvement uses
PreferredConstructorDiscoverer
from Spring Data Common to find the preferred constructor, which supports Kotlin (source).