Hello Guillaume and happy new year to you too. You are partly correct. At some point we will want to offer the ability to denormalize the information and copy the data of an entity when it is associated via a to-one association. This will be useful to load associated graphs in one lookup instead of two today.
But as it is today, to-one associations are always IN_ENTITY as we always have the foreign key value in the document. That's exactly what is happening when you use IN_ENTITY for a to-many association in MongoDB, we store the association information (ie foreign key values) in the entity document. Frankly, I don't think copying the foreign key value of a to-one association is a separate document makes much sense: - FK are small - by definition, to-one only point to one value so the payload is minimal. Does that make sense? Emmanuel On Wed 2013-01-02 15:40, Guillaume SCHEIBEL wrote: > Hi guys, > > First of all, happy new year I wish you the best (and to your relatives as > well). > > Lately I was wondering how can we use in IN_ENTITY association storage > principles for ManyTo* associations. I can't find a use case on that. > For example, if I have this: > - an entity Message > - an entity Comment > - a message is association to many comments > - a comment is associatied to exactly 1 message > > So in this case, the IN_ENTITY mode is relevant and useful because I won't > "never" access to Comment(s) other than by the associated message. > > But currently we are not making any differences regarding the type of the > association I think we will need to/ have to create some specific sets of > annotations for association type, right ? > > What is your opinion on that ? > Thanks > Guillaume _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev