See EntityManager.createNamedQuery(String queryName) and
Query.setParameter(...) methods.
glassfish_at_javadesktop.org wrote:
> Thanks again! Some pretty good advice actually.
>
> Named queries seems to be the way to go. Implementing them in the entity beans and calling them from the session beans. It is unfortunate that not all queries can be made static. It would, for example, be nice if it was possible to be able to do this:
> ...
> @NamedQuery(
> name="MyEntity.getItemsPerProductCategory",
> query="SELECT i FROM Item i WHERE i.product.categoryID IN :cID"
> )
>
> // where catIDs is String[] catIDs .... or ArrayList catIDs.... or " ('a','b','c') "
> query.setParameter("cID",catIDs);
> [Message sent by forum member 'woel' (woel)]
>
> http://forums.java.net/jive/thread.jspa?messageID=240935
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>