This query
Code:
select u.properties from User u
with this mapping
Code:
/**
* @hibernate.map table="userprops" lazy="true" cascade="all"
* @hibernate.collection-key column="userid"
* @hibernate.collection-index column="mapkey" type="string"
* @hibernate.collection-element column="value" type="string"
*/
public Map getProperties() {
return properties;
}
produces this error
Code:
org.hibernate.QueryException: not an entity [select u.properties from User u]
at org.hibernate.hql.ast.tree.FromElementType.renderIdentifierSelect(FromElementType.java:143)
at org.hibernate.hql.ast.tree.FromElement.renderIdentifierSelect(FromElement.java:167)
at org.hibernate.hql.ast.tree.SelectClause.renderNonScalarIdentifiers(SelectClause.java:398)
at org.hibernate.hql.ast.tree.SelectClause.renderNonScalarSelects(SelectClause.java:376)
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:218)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:702)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:531)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:645)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583)
How can I fix it?
Thx