Hi,

perhaps it is a dumb question; but it has taken a lot of time and I still have 
not found a solution.

I want to get all courses for a instructor in my EJB.



  | public List<Course> getCoursesForInstructor(CmtUser instructor){
  |  try{
  |                     
  |     String id = instructor.getId().toString();
  |        //Long id = instructor.getId();
  |     Query q = em.createQuery(
  |                     "SELECT c FROM Course c" +
  |                     " WHERE c.instructor = :instrId");
  |                     q.setParameter("instrId",id);
  | 
  |      List<Course> courses = (List<Course>) q.getResultList(); 
  |      return courses ;
  |     }
  | ...

If I type:
WHERE c.instructor = 2
it is no problem.
But if I set the parameter with:
q.setParameter("instrId",id);  I get an

IllegalArgumentException ...
  | ...org.hibernate.PropertyAccessException: could not get a field value by 
reflection getter of de.cmt.model.CmtUser.id)

Any ideas?
Thanks Nicki


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4193170#4193170

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4193170
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to