[hibernate-dev] [OGM] Distinguishing embedded collections and associations in document stores
Emmanuel Bernard
emmanuel at hibernate.org
Tue Dec 3 12:55:07 EST 2013
We probably need to revisit what we really want to test and adjust the
test accordingly. AFAIR, these tests felt weak anyways.
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