users@glassfish.java.net

Re: WHERE CLAUSE NOT WORKING

From: <glassfish_at_javadesktop.org>
Date: Thu, 01 Nov 2007 11:21:24 PST

Hi,

any special reason why you are using a native SQL query? As far as I understood your example, Section is a entity class (meaning it is annotated with @Entity). Then I propose to use a Java Persistence query:

Query q = em.createQuery("SELECT s FROM Section s WHERE s.id = :id");
q.setParameter("id", id);
List<Selection) result = q.getResultList();

The above assumes class Section has a field or property called id that is mapped to the column page_id in the database.

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

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