You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Chris Wolf <cw...@gmail.com> on 2013/04/11 22:24:18 UTC
What is the type parameter, 'X' for?
... in this interface?
public interface OpenJPAQuery<X> extends TypedQuery<X>
(an example would be good also)
Thanks,
Chris
Re: What is the type parameter, 'X' for?
Posted by Chris Wolf <cw...@gmail.com>.
Thanks, Pawel,
Yes, I normally try to stick with just javax.persistence API, but I wanted
to force fetching entire object graph and I thought eager fetching would do
that, as shown here:
http://openjpa.apache.org/builds/1.0.3/apache-openjpa-1.0.3/docs/manual/ref_guide_perfpack_eager.html
Example 5.23, but it didn't work... (I still had to iterate over
relationship Lists to provoke fetching of related entities)
Thanks,
-Chris
On Thu, Apr 11, 2013 at 4:38 PM, Pawel Veselov <pa...@gmail.com>wrote:
> On Thu, Apr 11, 2013 at 1:24 PM, Chris Wolf <cw...@gmail.com> wrote:
>
> > ... in this interface?
> >
> > public interface OpenJPAQuery<X> extends TypedQuery<X>
> >
> > (an example would be good also)
> >
>
> X is the class of the objects that the query is supposed to return.
>
> TypedQuery<EAgent> agents =
> em.createNamedQuery(EAgent.GET_ALL, EAgent.class);
> for (EAgent agent : agents.getResultList()) {
> // have fun
> }
>
> (sorry, I don't use OpenJPA classes directly)
>
>
> >
> > Thanks,
> >
> > Chris
> >
>
Re: What is the type parameter, 'X' for?
Posted by Pawel Veselov <pa...@gmail.com>.
On Thu, Apr 11, 2013 at 1:24 PM, Chris Wolf <cw...@gmail.com> wrote:
> ... in this interface?
>
> public interface OpenJPAQuery<X> extends TypedQuery<X>
>
> (an example would be good also)
>
X is the class of the objects that the query is supposed to return.
TypedQuery<EAgent> agents =
em.createNamedQuery(EAgent.GET_ALL, EAgent.class);
for (EAgent agent : agents.getResultList()) {
// have fun
}
(sorry, I don't use OpenJPA classes directly)
>
> Thanks,
>
> Chris
>
Re: What is the type parameter, 'X' for?
Posted by Rick Curtis <cu...@gmail.com>.
<X> is the query result type.
TypedQuery<Customer> q = em.createQuery("Select c FROM Customer c" ,
Customer.class);
Thanks,
Rick
On Thu, Apr 11, 2013 at 3:24 PM, Chris Wolf <cw...@gmail.com> wrote:
> ... in this interface?
>
> public interface OpenJPAQuery<X> extends TypedQuery<X>
>
> (an example would be good also)
>
> Thanks,
>
> Chris
>
--
*Rick Curtis*