Spring Data, MongoDB, Roo and Embedded Documents

Ray Hooker <[email protected]> Fri, 24 Jan 2014 15:49:20 -0500
Newsgroups gmane.org.user-groups.trijug.juglist
Message-ID <CAOhZ+NiM-vfTyKAoLGkyc=G0-ZH_jqgHNcQgc7k=EHVfqJinPA@mail.gmail.com>
--===============3591469089601641400==
Content-Type: multipart/alternative; boundary=047d7b15a6b5017ec404f0bd7e5b

--047d7b15a6b5017ec404f0bd7e5b
Content-Type: text/plain; charset=ISO-8859-1

I was looking for tips on working with MongoDB and embedded documents with
Spring Roo.  I am also to other approaches.  As you know, MongoDB is
document oriented and the power is when a document has subdocuments
embedded.  For example in the healthcare field, there are patient documents
export formats (C32, CCDA) that include a snapshot of the data in a single
XML document.  The question is how to work with these complex documents in
Spring Roo.

The examples I have seen for MongoDB, Spring Data and Spring Roo all lead
to separate documents.  What is needed is to have the entities referenced
in a one-to-many relationship where the data is actually retrieved from the
single large document returned.  So accessing the subdocuments only
requires parsing and not database reads.  So for example, I could define an
entity Record that has a field such as:

field reference --fieldName medications --type ~.domain.Medication
--cardinality ONE_TO_MANY --class ~.domain.Medication

If I were writing the code say using the native MongoDB driver, the
document would be returned as a BasicDBObject.  The record DAO for patient
would simply get the "medications" key that would return a list of
BasicDBObject's, each containing the data for a medication DAO.

So is there a way to get JPA/ Spring Roo to generate the repositories for
these subdocuments so that they are retrieved from the parent document and
not from MongoDB as a separate document? This is easy to do with Rails/
Mongoid, but I can't see how to do it with Roo.  Grails is a possibility if
it has the support. Hopefully both can do it, even if the intro docs do not
show how.

Thanks,

-- 
Ray Hooker

--047d7b15a6b5017ec404f0bd7e5b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I was looking for tips on working with MongoDB and embedde=
d documents with Spring Roo. =A0I am also to other approaches. =A0As you kn=
ow, MongoDB is document oriented and the power is when a document has subdo=
cuments embedded. =A0For example in the healthcare field, there are patient=
 documents export formats (C32, CCDA) that include a snapshot of the data i=
n a single XML document. =A0The question is how to work with these complex =
documents in Spring Roo. =A0<div>
<br></div><div>The examples I have seen for MongoDB, Spring Data and Spring=
 Roo all lead to separate documents. =A0What is needed is to have the entit=
ies referenced in a one-to-many relationship where the data is actually ret=
rieved from the single large document returned. =A0So accessing the subdocu=
ments only requires parsing and not database reads. =A0So for example, I co=
uld define an entity Record that has a field such as:</div>
<div><br></div><div>field reference --fieldName medications --type ~.domain=
.Medication --cardinality ONE_TO_MANY --class ~.domain.Medication</div><div=
><br></div><div>If I were writing the code say using the native MongoDB dri=
ver, the document would be returned as a BasicDBObject. =A0The record DAO f=
or patient would simply get the &quot;medications&quot; key that would retu=
rn a list of BasicDBObject&#39;s, each containing the data for a medication=
 DAO. =A0</div>
<div><br></div><div>So is there a way to get JPA/ Spring Roo to generate th=
e repositories for these subdocuments so that they are retrieved from the p=
arent document and not from MongoDB as a separate document? This is easy to=
 do with Rails/ Mongoid, but I can&#39;t see how to do it with Roo. =A0Grai=
ls is a possibility if it has the support. Hopefully both can do it, even i=
f the intro docs do not show how.</div>
<div><br></div><div>Thanks,<br clear=3D"all"><div><br></div>-- <br>Ray Hook=
er
</div><div><br></div><div><br></div></div>

--047d7b15a6b5017ec404f0bd7e5b--


--===============3591469089601641400==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Juglist mailing list
[email protected]
http://lists.trijug.org/mailman/listinfo/juglist_lists.trijug.org

--===============3591469089601641400==--