openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KARR, DAVID (ATTSI)" <dk0...@att.com>
Subject RE: Query for union of child list
Date Tue, 01 Jun 2010 16:14:09 GMT
> -----Original Message-----
> From: Pinaki Poddar [mailto:ppoddar@apache.org]
> Sent: Tuesday, June 01, 2010 9:01 AM
> To: users@openjpa.apache.org
> Subject: Re: Query for union of child list
> 
> 
> > I need to get a list of all the unique "Foo" objects in the
> "childFoos"
> list for all "Device" objects.
> 
>   JPA 2.0 introduced a new entity type expression for JPQL which may
be
> useful here.
>   I will expect something like (provided Product-Foo is a bi-
> directional
> relation)
> 
>   String jpql = "select f from Foo f where f.parent = :subtype";
>   em.createQuery(jpql)
>      .setParameter("subtype", Device.class)
>      .getResultList();

Unfortunately, I'm limited to OpenJPA 1.x for now.  What I have works, I
just wanted to know if there was a better way to do it.


Mime
View raw message