persistence@glassfish.java.net

Re: Dynamically creating named queries

From: Lance J. Andersen <Lance.Andersen_at_Sun.COM>
Date: Mon, 18 Jun 2007 10:45:16 -0400

Hi Farrukh,

You cannot dynamically create a named query, you can however create
dynamic queries which should do what you want. Also, please use
parameter binding vs concating params to the query

Regards
Lance

Farrukh S. Najmi wrote:
> Hello,
>
> In my application I need to dynamically create named queries based on
> configuration data for my application.
> I cannot statically define NamedQuery annotation in my code but instead
> need to create a NamedQuery through code.
>
> I assume this is possible? Is so, can someone please suggest how to do
> this. Thanks you for your help.
>
>