SourceForge has been redesigned. Learn more.
Close

Serializing SelectQuery to JSON

michaela
2012-07-24
2012-09-29
  • michaela

    michaela - 2012-07-24

    Hello,

    Is it possible to add support for serializing/de-serializing a given
    SelectQuery to/from JSON ?

    Thanks.

     
  • James Ahlborn

    James Ahlborn - 2012-07-25

    it's possible to do anything (given enough time), but it certainly would not
    be easy. what's your use case...?

     
  • michaela

    michaela - 2012-08-01

    The serialization to JSON is not mandatory anymore. But now would be useful
    that these objects to be java.io.Serializable.
    I need to store these objects in user's session, thus they need to be
    Serializable.
    Also, I had a use case where I needed to get a deep copy of the SelectQuery
    object. The only way I could accomplish this was by using a 3rd party library
    that can copy even non-serializable objects. (I used this one:
    http://code.google.com/p/cloning/).
    Although I could obtain this copy I would prefer being able to get this copy
    without using 3rd party libraries or implementing my own mechanisms using
    reflection.

    Could you make these types Serializable and/or provide a copying
    method/constructor ?

    Thanks.

     
  • James Ahlborn

    James Ahlborn - 2012-08-01

    Ah, deep cloning is perhaps a more compelling use case. having a base, pre-
    configured query instance and being able to copy that and modify it could be
    very useful. you should file that as a feature request. i think that is a
    fairly feasible idea (haven't entirely investigated it of course, just
    thinking off the top of my head).

    serialization, on the other hand, is most likely much more difficult to
    implement, which is why i ask for a clear use case when it is brought up.

     

Log in to post a comment.