At the very beginning, I thought to manage association like this:
- Case of @OneTo* associations could be managed like embeddeds (for me
it makes sens and close to the mongo way)
- Case of @ManyTo* associations could be managed in a usual way
(association collections, etc.)
Of course, at the end, we should provide a configuration system like an
@InsideAssociation to explicitly say "I want to store this association
inside the "master" one" no ?
And regarding the documentation
http://www.mongodb.org/display/DOCS/Database+References#DatabaseReference...
it could be an idea :)
what do you think ?
Guillaume
2012/4/25 Emmanuel Bernard <emmanuel(a)hibernate.org>
## Mapping strategy
I think we have explored three main options while implementing the
association mapping in MongoDB
1. Put the assoc info within the entity document we navigate from
2. Put the assoc info in a dedicated document and dedicated collection
3. Put the assoc info in n documents (one doc per row) and a dedicated
collection
And slightly orthogonal to this, we have considered to use a prefix for
the association collection to make sure it does not clash when mapping
@ManyToOne @JoinColumn.
I am reading MongoDB in Action and it seems option 1 is the most natural
for MongoDB. At least let's offer the option via a property collected by
the datastore / dialect. We can decide to reduce options down the road we
we have a better grasp. And that will prevent rewriting the dialect every
tie someone changes his mind (like me ;P)
## Optimizing what is store
We definitely store the same data over and over (like the table in
association rows. At some point we probably will want to clean that up to
do a more "natural" mapping.
(More) thoughts on associations?
Emmanuel
PS: this is nothing new but I'd rather capture this info by mail rather
than via IRC discussions to consolidate it.
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev