[jboss-user] [EJB 3.0] - Aliases in Queries

micho do-not-reply at jboss.com
Sat Feb 24 16:45:38 EST 2007


Hi, 
I´m not sure if this or the "persistence" group is the right one.

I created a Query like this
erg = (List<User>) em.createQuery( "from User u where (u.peter = :name)").setParameter ("name", "pete").getResultList();
  |  and it wors as expected.
If I change it an introduce an alias 
erg = (List<User>) em.createQuery( "from User where (peter = :name)").setParameter ("name", "pete").getResultList();
  | and it works.
  | 
I get an exception
javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.QueryException: could not resolve property: peter of: com.entity.User [from com.entity.User as u where (u.peter = :name)]
  | 

what´s wrong?


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021745




More information about the jboss-user mailing list