Incorrect deserialization of a kotlin class when loading it from mongodb #4733
Labels
status: feedback-provided
Feedback has been provided
status: waiting-for-triage
An issue we've not yet triaged
I'm sorry if this is the wrong place to file an issue, I've not found the right one in 10 minutes of googling.
Environment
Here is the class I'm trying to read from the database
here is the repository
Saving works just fine, but when I'm trying to load it from the database, I'm getting a weird error
Parameter org.springframework.data.mapping.Parameter@a972a9cc does not have a name
, inside of theorg.springframework.data.mapping.model.ClassGeneratingEntityInstantiator#extractInvocationArguments
. I've debugged the code and noticed that the last parameter in the extractInvocationArguments method is null and it identifies a default constructor. So, I added PersistenceCreator to my class like thisand everything works correctly now. The root cause of the problem lies in spring data adding an argument to the default class constructor, PersistenceCreator fixes it, because it is being parsed by the spring correctly. If needed I can debug once again and point to the functions there I think resolution is incorrect. The UserId is a value class, which has dedicated converter, but it works as expected.
The text was updated successfully, but these errors were encountered: