[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - setParameter() IllegalArgumentException
NSchweig
do-not-reply at jboss.com
Sat Nov 29 06:37:03 EST 2008
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
More information about the jboss-user
mailing list