Giter Club home page Giter Club logo

Comments (2)

rktoomey avatar rktoomey commented on June 27, 2024

Hi Andy,

I believe what you actually want to do here is break apart an object graph for persistence into separate collections?

I would suggest doing this instead using a parent id that references the top level object in the children, and then use SalatDAO with ChildCollection to break apart the object when you persist it and re-assemble it when you deserialize it. See the salat specs on the dao and child collections in salat-core.

I don't plan to support passing in a custom serializer as you propose at present (leaving aside the problem that custom serialization and deserialization must be paired or deserialization will fail), although future versions might allow you to define custom transformations for global types (like, say, java.net.URI).

from salat.

andypetrella avatar andypetrella commented on June 27, 2024

Hi Rose,

Thanks you, I've just adapt my model to use what you told me. Which works pretty well indead.

But still that it would be interesting to have such back and forth marshalling to handle objects graph splitted into several collections.

'Cause now, I've introduced some ObjectId as parameter of my case class, with lazy val that retrieves the orignial object. That fits the need but polute a little bit the model? Don't you think?

However, couldn't we have special behavior for ObjectId, Collection of ObjectId and Map valued by ObjectId fields ? By using an annotation for instance (I'm writing while thinking, sorry if it's dumb) like the following

case class Person(name:String, @listref[AddressDAO, "_id"] addresses:List[Address]) {}

This will store the _id of addresses as a mondgo db list.

Just my 0.02c

from salat.

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.