Re: [hibernate-dev] [OGM] Mapping associations in MongoDB

2012-04-25 Thread Guillaume SCHEIBEL
Simply because I didn't know this annotation :) next time I won't say anything ;) (at least I've learn something) Guillaume 2012/4/25 Emmanuel Bernard > Why not use @ElementCollection for such a case instead of @OneToMany? > > > On 25 avr. 2012, at 17:54, Guillaume SCHEIBEL < > guillaume.sch

Re: [hibernate-dev] [OGM] Mapping associations in MongoDB

2012-04-25 Thread Emmanuel Bernard
Why not use @ElementCollection for such a case instead of @OneToMany? On 25 avr. 2012, at 17:54, Guillaume SCHEIBEL wrote: > No, I don't think so > > The first case could be: > class Post { > @OneToMany > List comments; > //... > } > > and so in mongodb > > { > "_id": Object

Re: [hibernate-dev] [OGM] Mapping associations in MongoDB

2012-04-25 Thread Guillaume SCHEIBEL
No, I don't think so The first case could be: class Post { @OneToMany List comments; //... } and so in mongodb { "_id": ObjectId("4f981b173572f2a35c3826f8"), "title": "About collections", "comments": [ { "author": "Emmanuel", "content": "my comment"

Re: [hibernate-dev] [OGM] Mapping associations in MongoDB

2012-04-25 Thread Emmanuel Bernard
On 25 avr. 2012, at 10:05, Guillaume SCHEIBEL wrote: > 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

Re: [hibernate-dev] [OGM] Mapping associations in MongoDB

2012-04-25 Thread Emmanuel Bernard
On 25 avr. 2012, at 10:05, Guillaume SCHEIBEL wrote: > And regarding the documentation > http://www.mongodb.org/display/DOCS/Database+References#DatabaseReferences-DBRef > it could be an idea :) >From what I understand of DBRefs, they bring no value to us in the OGM >context. They can even be

Re: [hibernate-dev] [OGM] Mapping associations in MongoDB

2012-04-25 Thread Guillaume SCHEIBEL
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,

[hibernate-dev] [OGM] Mapping associations in MongoDB

2012-04-25 Thread Emmanuel Bernard
## 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