net.sf.hibernate.QueryException: could not resolve property: employees [where ? in elements(this.employees)]

Hibernate JIRA | Alessandro Vernet | 1 decade ago
  1. 0

    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

    Hibernate JIRA | 1 decade ago | Alessandro Vernet
    net.sf.hibernate.QueryException: could not resolve property: employees [where ? in elements(this.employees)]
  2. 0

    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

    Hibernate JIRA | 1 decade ago | Alessandro Vernet
    net.sf.hibernate.QueryException: could not resolve property: employees [where ? in elements(this.employees)]
  3. 0

    I'm switching to 2.0.1 from 1.2.3. I received the following error trying to do a query on a collection that's within a component. Obviously, this used to work in 1.2.3. I've included part of my mapping below. Using elements(mov.cast.cast.list) did not help. net.sf.hibernate.QueryException: could not resolve property type: cast.cast.null [SELECT mov.id FROM mov in class Movie WHERE :findTarget in mov.component.list.elements] at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:223) at net.sf.hibernate.hql.PathExpressionParser.end(PathExpressionParser.java:270) at net.sf.hibernate.hql.WhereParser.preprocess(WhereParser.java:347) at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:355) at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:389) at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:275) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:73) at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:120) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:145) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:132) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:373) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:351) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1381) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1345) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:76) at com.fetchaflick.videotest.ojb.FetchaQuery.list(FetchaQuery.java:45) at com.fetchaflick.videotest.movie.BaseMovieFinder.findPageBy(BaseMovieFinder.java:62) at com.fetchaflick.videotest.movie.BaseMovieFinder.findPageByActor(BaseMovieFinder.java:45) at com.fetchaflick.videotest.movie.MovieFinderTest.testFindByActor(MovieFinderTest.java:100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) <class name="Movie" table="PRODUCT"> <component name="component" class="com.fetchaflick.videotest.movie.Cast"> <list name="list" table="MOVIE_CAST" cascade="all"> <jcs-cache usage="read-write"/> <key column="MOVIE_ID"/> <index column="POS"/> <element type="string" column="NAME"/> </list> </component> </class> Original thread on the forum http://sourceforge.net/forum/forum.php?thread_id=889001&forum_id=128638 I put this in JIRA a while ago, but I guess it lost it (and my account)?

    Hibernate JIRA | 1 decade ago | Rex Madden
    net.sf.hibernate.QueryException: could not resolve property type: cast.cast.null [SELECT mov.id FROM mov in class Movie WHERE :findTarget in mov.component.list.elements]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    http://sourceforge.net/forum/message.php?msg_id=2073580 I'm switching to 2.0.1 from 1.2.3. I received the following error trying to do a query on a collection that's within a component. Obviously, this used to work in 1.2.3. I've included part of my mapping below. Any advice on how to get this to work would be appreciated. net.sf.hibernate.QueryException: could not resolve property type: cast.cast.null [SELECT mov.id FROM mov in class com.fetchaflick.videotest.movie.Movie WHERE :findTarget in mov.cast.cast.list.elements AND mov.status >= :status ORDER BY mov.nakedTitle desc] at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:223) at net.sf.hibernate.hql.PathExpressionParser.end(PathExpressionParser.java:270) at net.sf.hibernate.hql.WhereParser.preprocess(WhereParser.java:347) at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:355) at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:389) at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:275) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:73) at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:120) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:145) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:132) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:373) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:351) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1381) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1345) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:76) at com.fetchaflick.videotest.ojb.FetchaQuery.list(FetchaQuery.java:45) at com.fetchaflick.videotest.movie.BaseMovieFinder.findPageBy(BaseMovieFinder.java:62) at com.fetchaflick.videotest.movie.BaseMovieFinder.findPageByActor(BaseMovieFinder.java:45) at com.fetchaflick.videotest.movie.MovieFinderTest.testFindByActor(MovieFinderTest.java:100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) <class name="com.fetchaflick.videotest.movie.Product" table="PRODUCT"> <jcs-cache usage="read-write"/> <id name="id" column="id" type="long" unsaved-value="0"> <generator class="assigned"/> </id> <discriminator column="TYPE"/> <version column="version" name="version" type="integer"/> <property name="status" column="STATUS" type="com.fetchaflick.videotest.ojb.ProductStatusFieldConversion"/> <many-to-one name="priceLevel" column="PRICE_LEVEL_ID" class="com.fetchaflick.videotest.movie.PriceLevel" cascade="none" outer-join="auto"/> <subclass name="com.fetchaflick.videotest.movie.BaseMovie" discriminator-value="basemovie"> <property name="releaseDate" column="RELEASE_DATE"/> <property name="nakedTitle" column="NAKED_TITLE"/> <many-to-one name="releaseType" column="RELEASE_TYPE_ID" class="com.fetchaflick.videotest.movie.ReleaseType" cascade="none" /> <component name="cast" class="com.fetchaflick.videotest.movie.Cast"> <component name="cast" class="com.fetchaflick.videotest.movie.SafeList"> <list name="list" table="MOVIE_CAST" cascade="all"> <jcs-cache usage="read-write"/> <key column="MOVIE_ID"/> <index column="POS"/> <element type="string" column="NAME"/> </list> </component> </component> <subclass name="com.fetchaflick.videotest.movie.AdultMovie" discriminator-value="adult"> <property name="studio" column="STUDIO"/> </subclass> <subclass name="com.fetchaflick.videotest.movie.Movie" discriminator-value="movie"> <component name="criticReviews" class="com.fetchaflick.videotest.movie.CriticReviewList"> <component name="reviews" class="com.fetchaflick.videotest.movie.SafeList"> <list name="list" table="MOVIE_CRITIC_REVIEWS" cascade="all"> <jcs-cache usage="read-write"/> <key column="MOVIE_ID"/> <index column="POS"/> <composite-element class="com.fetchaflick.videotest.movie.CriticReview"> <property name="author" column="AUTHOR"/> <property name="link" column="LINK"/> <property name="publication" column="PUBLICATION"/> <property name="rating" type="com.fetchaflick.videotest.ojb.CriticReviewRatingFieldConversion"> <column name="RATING"/> <column name="RATING_MAX"/> </property> <property name="synopsis" column="SYNOPSIS"/> </composite-element> </list> </component> </component> </subclass> </subclass> </class>

    Hibernate JIRA | 1 decade ago | Gavin King
    net.sf.hibernate.QueryException: could not resolve property type: cast.cast.null [SELECT mov.id FROM mov in class com.fetchaflick.videotest.movie.Movie WHERE :findTarget in mov.cast.cast.list.elements AND mov.status >= :status ORDER BY mov.nakedTitle desc]
  6. 0

    I'm switching to 2.0.1 from 1.2.3. I received the following error trying to do a query on a collection that's within a component. Obviously, this used to work in 1.2.3. I've included part of my mapping below. Using elements(mov.cast.cast.list) did not help. net.sf.hibernate.QueryException: could not resolve property type: cast.cast.null [SELECT mov.id FROM mov in class Movie WHERE :findTarget in mov.component.list.elements] at net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:223) at net.sf.hibernate.hql.PathExpressionParser.end(PathExpressionParser.java:270) at net.sf.hibernate.hql.WhereParser.preprocess(WhereParser.java:347) at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:355) at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:389) at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:275) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:73) at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:120) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:145) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:132) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:373) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:351) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1381) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1345) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:76) at com.fetchaflick.videotest.ojb.FetchaQuery.list(FetchaQuery.java:45) at com.fetchaflick.videotest.movie.BaseMovieFinder.findPageBy(BaseMovieFinder.java:62) at com.fetchaflick.videotest.movie.BaseMovieFinder.findPageByActor(BaseMovieFinder.java:45) at com.fetchaflick.videotest.movie.MovieFinderTest.testFindByActor(MovieFinderTest.java:100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) <class name="Movie" table="PRODUCT"> <component name="component" class="com.fetchaflick.videotest.movie.Cast"> <list name="list" table="MOVIE_CAST" cascade="all"> <jcs-cache usage="read-write"/> <key column="MOVIE_ID"/> <index column="POS"/> <element type="string" column="NAME"/> </list> </component> </class> Original thread on the forum http://sourceforge.net/forum/forum.php?thread_id=889001&forum_id=128638 I put this in JIRA a while ago, but I guess it lost it (and my account)?

    Hibernate JIRA | 1 decade ago | Rex Madden
    net.sf.hibernate.QueryException: could not resolve property type: cast.cast.null [SELECT mov.id FROM mov in class Movie WHERE :findTarget in mov.component.list.elements]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.hibernate.QueryException

      could not resolve property: employees [where ? in elements(this.employees)]

      at net.sf.hibernate.persister.AbstractPropertyMapping.getPropertyType()
    2. net.sf.hibernate
      SessionImpl.filter
      1. net.sf.hibernate.persister.AbstractPropertyMapping.getPropertyType(AbstractPropertyMapping.java:33)
      2. net.sf.hibernate.hql.PathExpressionParser.getPropertyType(PathExpressionParser.java:242)
      3. net.sf.hibernate.hql.PathExpressionParser.token(PathExpressionParser.java:122)
      4. net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:333)
      5. net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:365)
      6. net.sf.hibernate.hql.WhereParser.token(WhereParser.java:250)
      7. net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
      8. net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:142)
      9. net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
      10. net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:148)
      11. net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:135)
      12. net.sf.hibernate.hql.FilterTranslator.compile(FilterTranslator.java:25)
      13. net.sf.hibernate.impl.SessionFactoryImpl.getFilter(SessionFactoryImpl.java:269)
      14. net.sf.hibernate.impl.SessionImpl.getFilterTranslator(SessionImpl.java:3149)
      15. net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3169)
      16. net.sf.hibernate.impl.SessionImpl.filter(SessionImpl.java:3109)
      16 frames