You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by Nune Isabekyan <ni...@gmail.com> on 2012/11/07 19:54:34 UTC

question regarding MongoDB integration

Hi,

I have been looking into the code from mongoDB integration and I have a
question whether it was an intentional decision not to use @Document
annotation for mapping with Collection...Correct me if I am wrong you
decided to keep the className in the collection and serialize/deserialize
that manually...I am just wondering why...

Thanks in advance.

Regards,
Nune

Re: question regarding MongoDB integration

Posted by Nune Isabekyan <ni...@gmail.com>.
Thanks for the answer. well as the documentation goes :

"it allows the classpath scanner to find and pre-process your domain
objects to extract the necessary metadata. If you don't use this
annotation, your application will take a slight performance hit the first
time you store a domain object because the mapping framework needs to build
up its internal metadata model so it knows about the properties of your
domain object and how to persist them."

I would also suggest using
@PersistenceConstructor - marks a given constructor - even a package
protected one - to use when instantiating the object from the database.
Constructor arguments are mapped by name to the key values in the retrieved
DBObject. for the deserialization part...

But if it's the case with other class usage - not worth that probably :)
I am in the middle of doing something similar as well, trying to figure out
the best way :)

Regards,
Nune

On 8 November 2012 15:42, Franklin, Matthew B. <mf...@mitre.org> wrote:

> On 11/7/12 1:54 PM, "Nune Isabekyan" <ni...@gmail.com> wrote:
>
> >Hi,
> >
> >I have been looking into the code from mongoDB integration and I have a
> >question whether it was an intentional decision not to use @Document
> >annotation for mapping with Collection...Correct me if I am wrong you
> >decided to keep the className in the collection and serialize/deserialize
> >that manually...I am just wondering why...
>
> The class name is an attribute of the document and is used for
> deserialization.  We are just using a static string to specify the
> collection.  The choice to not use the @Document annotation was made
> because there are a few instances where we just use the Rave impl classes,
> which are not in the Rave mongodb project.
>
> As far as I am aware, the annotation only helps specify the collection to
> save it in.  Is there another benefit?
>
> >
> >Thanks in advance.
> >
> >Regards,
> >Nune
>
>

Re: question regarding MongoDB integration

Posted by "Franklin, Matthew B." <mf...@mitre.org>.
On 11/7/12 1:54 PM, "Nune Isabekyan" <ni...@gmail.com> wrote:

>Hi,
>
>I have been looking into the code from mongoDB integration and I have a
>question whether it was an intentional decision not to use @Document
>annotation for mapping with Collection...Correct me if I am wrong you
>decided to keep the className in the collection and serialize/deserialize
>that manually...I am just wondering why...

The class name is an attribute of the document and is used for
deserialization.  We are just using a static string to specify the
collection.  The choice to not use the @Document annotation was made
because there are a few instances where we just use the Rave impl classes,
which are not in the Rave mongodb project.

As far as I am aware, the annotation only helps specify the collection to
save it in.  Is there another benefit?

>
>Thanks in advance.
>
>Regards,
>Nune