-
Notifications
You must be signed in to change notification settings - Fork 14
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
Support use of @Converter on String field #55
Comments
Converting a String to a Long is frankly a strange thing to do, FYI, to persist you would need to update https://github.com/datanucleus/datanucleus-mongodb/blob/master/src/main/java/org/datanucleus/store/mongodb/fieldmanager/StoreFieldManager.java#L169 and to retrieve you would need to update https://github.com/datanucleus/datanucleus-mongodb/blob/master/src/main/java/org/datanucleus/store/mongodb/fieldmanager/FetchFieldManager.java#L246 but that would be just for String fields. Then you have Long, Short, Integer, Double, etc. The fields that are supported for converters are "Object" field types (except the primitive wrappers). |
@andyjefferson okay I will check the code, so at the surface now the problem is not with the core or JDO module but rather the mongodb database module? Yes, in fact it is strange, but there's a concrete use-case for this which is to query local time ranges (not date) And do, something like: |
See https://github.com/andyjefferson/mongodb-55 for updated testcase that strips out irrelevant code. Note that it could be simplified further and just have a class with a String field, rather than embedding a collection of some subtype with a String field! |
With these classes:
And
The converter does not work, the stored document should be a number/Long and not the String field value since there is a converter. The converter code can be found here: https://github.com/cyberquarks/test-jdo-converter/blob/master/src/main/java/mydomain/model/converter/LocalTimeConverter.java
Here's the test case: https://github.com/cyberquarks/test-jdo-converter
The issue affects the latest version of Datanucleus/Datanucleus JDO
The text was updated successfully, but these errors were encountered: