users@glassfish.java.net

JPA query and enum field

From: <glassfish_at_javadesktop.org>
Date: Fri, 28 Sep 2007 06:19:01 PDT

Hi!

   Can someone tell me what's wrong with my query?

I have:

BloodType.java :
public enum BloodType {
      A, B, AB, O
}

Student.java:
@Entity
public class Student {

    @Id
     Long id;

    @Enumerated(STRING)
     BloodType bt;

    ...
}

  // get all students with BloodType <> O

  List<Student> list;

  list = em.createQuery("select s from Student s where s.bt <> :bt").setParameter("bt", BloodType.O).getResultList();

     I'm using GF V2 b58g-fcs

  Running the query the returned list contains students with blood type O.

    Thanks,

    Leandro
[Message sent by forum member 'leandro_komosinski' (leandro_komosinski)]

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