-
Notifications
You must be signed in to change notification settings - Fork 454
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
Embedded entity with mixup of strings and long for the same attribute works till 2.2.X but not upon 2.3.X #2200
Comments
Can you put together a reproducer? I'm not sure how that would work under 2.2 but not 2.3, either. |
Hi @evanchooly I invested time in fixing this issue not writing the sample code with reproducer yet. But I can tell you it works with 2.2 and the mixup of string/long/int fields in mongo with this trick (this API got removed in 2.3):
see full implementation:
How can you get the attribute which is type long in the entity as type string in the mongo database.
|
that reproducer would really help. Seeing what changes in the database would be useful to see. |
Hi @evanchooly okay I wrote reproducer tests to compare Morphia 2.2.3 - working Morphia 2.3.0 - broken and the diff of changes: you´ll get the error as described with 2.3 - with 2.2.3 all works fine.
|
Describe the bug
Having an embedded entity annotated as entity can be properly mapped / read from DB with 2.2, but not with 2.3
Attention: The documents in mongo for this error can be either contain string or long values - this worked fine with 2.2, not with 2.3
e.g. Java class:
and data in mongo with mixup of long and string
will result in:
Caused by: dev.morphia.mapping.MappingException: The type 'xxx.xxx.MyId' can not be instantiated: Can not set long field xxx.xxx.myId to java.lang.String
The text was updated successfully, but these errors were encountered: