[hibernate-dev] [OGM] Distinguishing embedded collections and associations in document stores
Gunnar Morling
gunnar at hibernate.org
Tue Dec 3 13:08:28 EST 2013
Thanks for following up on this.
2013/12/3 Emmanuel Bernard <emmanuel at hibernate.org>
> We probably need to revisit what we really want to test and adjust the
> test accordingly. AFAIR, these tests felt weak anyways.
>
Yes, that has been on my agenda for some day anyways. Test failures are
hard to analyze as the assertion methods don't reveal the actual vs.
expected association count, so one always needs to debug.
To move forward I'm just working around the issue by considering all
CouchDB entity-substructures as associations in the test. This seems good
enough for the time being as the assertion method in question is never used
for cases with actual embeddables.
We can then improve the tests/assertions in a next step.
--Gunnar
>
> On Fri 2013-11-29 11:49, Gunnar Morling wrote:
> > Hi,
> >
> > I'm working on support for embedded associations in CouchDB [1]. Checking
> > how this is mapped by the MongoDB dialect I saw its done like this (here
> > with an order column):
> >
> > {
> > "_id": "123",
> > "orderedChildren": [
> > {
> > "birthorder": 0,
> > "orderedChildren_id": "456"
> > },
> > {
> > "birthorder": 1,
> > "orderedChildren_id": "789"
> > }
> > ]
> > }
> >
> > Just looking at this document one can't tell whether "orderedChildren"
> > actually represents an association or an embedded collection. For our
> > engine that's no problem as it knows the kind of the element from its
> > meta-model.
> >
> > We have a testing approach though which makes assertions on the number of
> > associations stored in the database. With the representation described
> > above the number of embedded associations can't be determined on the
> > server-side alone (using a "view" in CouchDB terms).
> >
> > Besides from adding an attribute which describes the kind of a collection
> > (which wouldn't be so nice as it was just for testing purposes), I don't
> > see any other way than obtaining all the candidates and single out actual
> > associations on the client based on the meta-model.
> >
> > Maybe anyone has a better idea?
> >
> > Btw. for MongoDB the problem is ignored by having the assertion method
> > always return true in this case.
> >
> > --Gunnar
> >
> > [1] https://hibernate.atlassian.net/browse/OGM-389
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
More information about the hibernate-dev
mailing list