You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Christian Defoy <ch...@gmail.com> on 2007/07/22 16:40:24 UTC
How to filter set
Hello,
I am looking for a way to filter a set while loading it into an
object. For example, if class Shape contains a reference to a set of
Drawings but the drawings are never deleted from the database but
retired instead. How do I fill the attribute Shape.activeDrawings?
The JPQL-like way of doing this would be:
SELECT d FROM Drawing d WHERE d.shape.id = ? and d.retirementDate is null
but how do I create a mapping that does the same thing?
Thanks in advance!
Christian
Re: How to filter set
Posted by Patrick Linskey <pl...@gmail.com>.
Hi,
You can almost do this with a constant join:
http://openjpa.apache.org/docs/latest/manual/manual.html#ref_guide_mapping_notes_nonstdjoins
However, I believe that this currently only can be used for adding
constant value equality comparisons; I don't think that we support a
not-null comparison concept. It probably would be pretty
straightforward to add.
-Patrick
On 7/22/07, Christian Defoy <ch...@gmail.com> wrote:
> Hello,
>
> I am looking for a way to filter a set while loading it into an
> object. For example, if class Shape contains a reference to a set of
> Drawings but the drawings are never deleted from the database but
> retired instead. How do I fill the attribute Shape.activeDrawings?
>
> The JPQL-like way of doing this would be:
>
> SELECT d FROM Drawing d WHERE d.shape.id = ? and d.retirementDate is null
>
> but how do I create a mapping that does the same thing?
>
> Thanks in advance!
>
> Christian
>
--
Patrick Linskey
202 669 5907