Giter Club home page Giter Club logo

Comments (3)

andyjefferson avatar andyjefferson commented on July 20, 2024

Converting a String to a Long is frankly a strange thing to do, @Convert is for allowing otherwise non-persistable things to be persisted by converting to an acceptable type. Clearly it could be possible to support such a thing with effort but I personally won't be doing so. You could contribute this if it is important to you

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).

from datanucleus-mongodb.

cyberquarks avatar cyberquarks commented on July 20, 2024

@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)
So one could query for a LocalTime within a range of LocalTimes (hence opens, and closes field)

And do, something like:
SELECT FROM mydomain.Hub WHERE this.schedules.contains(sch) && (sch.day == :schDay && sch.opens <= :startTime && sch.closes >= :endTime)

from datanucleus-mongodb.

andyjefferson avatar andyjefferson commented on July 20, 2024

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!

from datanucleus-mongodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.