users@glassfish.java.net

Re: EJB QL syntax

From: <glassfish_at_javadesktop.org>
Date: Sun, 30 Sep 2007 08:55:21 PDT

Hi,

I think you need to pass the wildcard character as part of the parameter value.
The following sample code retrieves all categories having a name starting with 'A':
Query q = em.createQuery("SELECT c FROM Categories c WHERE c.categoryname LIKE :categoryname");
q.setParameter("categoryname", "A%");
List<Categories> result = q.getResultList();

You find a description of the Java Persistence query language in the persistence part of the JSR-200 spec (see http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html).

Regards Michael
[Message sent by forum member 'mb124283' (mb124283)]

http://forums.java.net/jive/thread.jspa?messageID=237741