users@glassfish.java.net

Re: TopLink: em.getReference downloads data from database

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Mon, 25 Jun 2007 09:18:09 +0200

I think the pharse: "whose state may be lazily fetched" is there only
because the entity might be already in cache, but downloading it from
database seems to be what you said, it defeats purpose of that API
and.. this is what makes my application slow.

2007/6/25, Sahoo <Sahoo_at_sun.com>:
> Hi,
>
> The spec [1] allows a provider to fetch the state from a database (see
> the use of *may* in the javadocs). But, I agree with you that
> implementing getReference() this way defeats the purpose of having that
> API. I don't know the rational behind the current implementation. Let's
> hope someone clarifies the same.
>
> Thanks,
> Sahoo
>
> [1]
> http://java.sun.com/javaee/5/docs/api/javax/persistence/EntityManager.html#getReference(java.lang.Class,%20java.lang.Object)
>
> Witold Szczerba wrote:
> > Hi there,
> > I have problem with TopLink, because em.getReference is fetching data
> > from database the same way as em.find does. But sometimes, there is no
> > need to fetch entity, only reference is important, for example, to use
> > it as a foreign key in some query.
> > Is it a bug? Why em.getReference acts the same way as em.find?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>