Hi,

I am having problems with rather simple Hibernate queries not returning the 
results I would expect when using query parameters:

  | Account account = (Account) entityManager
  |             .createQuery("SELECT c.account FROM Customer c WHERE 
c.salesperson.name = :salesname")
  |             .setParameter("salesname", salesGuyname).getSingleResult();
  | 
-> 0 results (NoResultException)

However, it works if I don't use query parameters and create the query string 
with concatenation:

  | Account account = (Account) entityManager
  |             .createQuery("SELECT c.account FROM Customer c WHERE 
c.salesperson.name = '" + salesGuyname + "'")
  |             .getSingleResult();
  | 
-> 1 result (the one I'm expecting)

I'm using JBoss 4.2.2 with MySQL 4.1. Does anyone have an idea where this could 
come from?

Thanks,
Georges

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

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

Reply via email to