openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: multiple search parameter
Date Thu, 15 Apr 2010 13:25:43 GMT
I'm assuming you are talking about allowing a user to select which fields to
search on and provide values for these search parameters.  If that's
correct, then this seems like a good example for the Criteria API in our
OpenJPA 2.0.x release.  The Criteria API is new for JPA 2.  This allows a
programmatic aspect to query generation.  Pinaki has written a nice white
paper on the Criteria API [1] to get you started.  You can also reference
the JPA 2 spec [2], but that gets a bit dry.  Another reference is the Pro
JPA 2 book [3] that was recently released.  Mike Keith, one of the authors,
was on the JPA expert group with Pinaki and myself and provides an
easy-to-understand view of the JPA 2 spec.

If you can't move to JPA 2 yet, then you could still use the JPQL
capabilities in JPA 1.  But, you will be required to do massive string
manipulation.  Especially since you are attempting to provide a flexible
interface for the queries.

Hope this helps,
Kevin

[1]  http://www.ibm.com/developerworks/java/library/j-typesafejpa/
[2]  http://jcp.org/en/jsr/detail?id=317
[3]  http://apress.com/book/view/1430219564

On Wed, Apr 14, 2010 at 10:14 PM, sp reddy <snakeoil82@gmail.com> wrote:

>
> I have a scenerio where I have more than 15 fields to search from. Any
> combination should be valid.
> What is the best approach to accomplish this. Eg, user can search from
> entering 2 fields or all 15.
>
> Thanks in advance......
> --
> View this message in context:
> http://n2.nabble.com/multiple-search-parameter-tp4905375p4905375.html
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message