users@glassfish.java.net

Re: TopLink: em.getReference downloads data from database

From: Sahoo <Sahoo_at_Sun.COM>
Date: Mon, 25 Jun 2007 10:25:34 +0530

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
>