net.sf.hibernate.QueryException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I am doing a: session.filter(regions, "where ? in elements(this.employees)", employee, Hibernate.entity(Employee.class)); Where Region.hbm.xml defines employees as: <hibernate-mapping> <class name="bean.Region" table="owf_region" mutable="false"> ... <set name="employees" table="owf_employee_region"> <key column="region_id"/> <many-to-many class="bean.Employee" column="employee_id"/> </set> </class> </hibernate-mapping> I get: net.sf.hibernate.QueryException: could not resolve property: employees [where ? in elements(this.employees)] at net.sf.hibernate.persister.AbstractPropertyMapping.getPropertyType(AbstractPropertyMapping.java:33) at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:242) at net.sf.hibernate.hql.PathExpressionParser.token(PathExpressionParser.java:122) at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:333) at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:365) at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:250) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87) at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:148) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:135) at net.sf.hibernate.hql.FilterTranslator.compile(FilterTranslator.java:25) at net.sf.hibernate.impl.SessionFactoryImpl.getFilter(SessionFactoryImpl.java:269) at net.sf.hibernate.impl.SessionImpl.getFilterTranslator(SessionImpl.java:3149) at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3169) at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3109) I expected this to work. Pretty much the same HQL works just fine when used in a session.createQuery(), e.g.: session.createQuery("from Region as r where ? in elements(r.employees)").setEntity(0, employee).list() Alex
    via by Alessandro Vernet,
  • I am doing a: session.filter(regions, "where ? in elements(this.employees)", employee, Hibernate.entity(Employee.class)); Where Region.hbm.xml defines employees as: <hibernate-mapping> <class name="bean.Region" table="owf_region" mutable="false"> ... <set name="employees" table="owf_employee_region"> <key column="region_id"/> <many-to-many class="bean.Employee" column="employee_id"/> </set> </class> </hibernate-mapping> I get: net.sf.hibernate.QueryException: could not resolve property: employees [where ? in elements(this.employees)] at net.sf.hibernate.persister.AbstractPropertyMapping.getPropertyType(AbstractPropertyMapping.java:33) at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:242) at net.sf.hibernate.hql.PathExpressionParser.token(PathExpressionParser.java:122) at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:333) at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:365) at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:250) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87) at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:148) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:135) at net.sf.hibernate.hql.FilterTranslator.compile(FilterTranslator.java:25) at net.sf.hibernate.impl.SessionFactoryImpl.getFilter(SessionFactoryImpl.java:269) at net.sf.hibernate.impl.SessionImpl.getFilterTranslator(SessionImpl.java:3149) at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3169) at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3109) I expected this to work. Pretty much the same HQL works just fine when used in a session.createQuery(), e.g.: session.createQuery("from Region as r where ? in elements(r.employees)").setEntity(0, employee).list() Alex
    via by Alessandro Vernet,
    • net.sf.hibernate.QueryException: could not resolve property: employees [where ? in elements(this.employees)] at net.sf.hibernate.persister.AbstractPropertyMapping.getPropertyType(AbstractPropertyMapping.java:33) at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:242) at net.sf.hibernate.hql.PathExpressionParser.token(PathExpressionParser.java:122) at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:333) at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:365) at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:250) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87) at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:148) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:135) at net.sf.hibernate.hql.FilterTranslator.compile(FilterTranslator.java:25) at net.sf.hibernate.impl.SessionFactoryImpl.getFilter(SessionFactoryImpl.java:269) at net.sf.hibernate.impl.SessionImpl.getFilterTranslator(SessionImpl.java:3149) at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3169) at net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3109)
    No Bugmate found.