Hibernate version:
2.1.6
How do I use a property that is "any-mapped" in a where-clause?
I keep getting this:
net.sf.hibernate.QueryException: path expression ends in a composite value: link0_.chained [from com.mds.pepland.persistence.Link link where link.chained=?]
at net.sf.hibernate.hql.PathExpressionParser.getWhereColumn(PathExpressionParser.java:375)
at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:352)
at net.sf.hibernate.hql.WhereParser.doToken(WhereParser.java:366)
at net.sf.hibernate.hql.WhereParser.token(WhereParser.java:251)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:294)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1562)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1521)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1517)
at com.mds.pepland.da.SearchDAO.deleteSearch(SearchDAO.java:85)
The query goes like this:
session.find("from Link link where link.chained=?", search, Hibernate.any(Hibernate.INTEGER, Hibernate.STRING));
The Link class has an any-mapping like this:
<any name="chained" id-type="java.lang.Integer" meta-type="string">
<meta-value value="Identification" class="com.mds.pepland.persistence.IdentificationImpl"/>
<meta-value value="FragmentIdentification" class="com.mds.pepland.persistence.FragmentIdentificationImpl"/>
<meta-value value="Search" class="com.mds.pepland.persistence.Search"/>
...
<column name="chained_table" length="32"/>
<column name="chained_id"/>
</any>
I've tried different variations for the type argument of session.find, but nothing seems to be working..
I'm suspecting that Hibernate does not support support this sort query, even though it seems natural to do it like this.. What are my options then? using a Hibernate SQL query?
regards...
_________________ Hibernate rocks!
|