Hibernate Version 3.1
I am getting exception(could not resolve property) when I do the following query :
Query q1 = newSession.createQuery("from VsDomains domains where domains.dns_profile_id = :dns_profile")
But everything is fine when I do the one below :
Query q1 = newSession.createQuery("from VsDomains where dns_profile_id = :dns_profile_id");
This is the code that invokes the query:
.setProperty("hibernate.query.factory_class","org.hibernate.hql.classic.ClassicQueryTranslatorFactory")
.setProperty("hibernate.dialect", "org.hibernate.dialect.Oracle9Dialect")
.setProperty("hibernate.connection.driver_class", "oracle.jdbc.driver.OracleDriver")
test.factory = cfg.buildSessionFactory();
Session newSession = test.factory.openSession();
Transaction newTransaction = newSession.beginTransaction();
Query q1 = newSession.createQuery("from VsDomains domains where domains.dns_profile_id = :dns_profile_id");
q1.setParameter("dns_profile_id",f_dnsProfileId);
Exception :
---------------------------------
DEBUG 05/16/2006 12:42:36 <ExecuteThread: '59' for queue: 'default'> <hql.ast.QueryTranslatorImpl> parse() - HQL: from com.verisign.dbms.portal.VsDomains d where d.dns_profile_id = :dns_profile_id
DEBUG 05/16/2006 12:42:36 <ExecuteThread: '59' for queue: 'default'> <hql.ast.AST> --- HQL AST ---
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| \-[FROM] 'from'
| | \-[IDENT] 'VsDomains'
| \-[ALIAS] 'd'
\-[WHERE] 'where'
\-[EQ] '='
+-[DOT] '.'
| +-[IDENT] 'd'
| \-[IDENT] 'dns_profile_id'
\-[COLON] ':'
\-[IDENT] 'dns_profile_id'
DEBUG 05/16/2006 12:42:36 <ExecuteThread: '59' for queue: 'default'> <hql.ast.ErrorCounter> throwQueryException() : no errors
DEBUG 05/16/2006 12:42:36 <ExecuteThread: '59' for queue: 'default'> <hql.antlr.HqlSqlBaseWalker> select << begin [level=1, statement=select]
DEBUG 05/16/2006 12:42:36 <ExecuteThread: '59' for queue: 'default'> <ast.tree.FromElement> FromClause{level=1} : VsDomains (d) -> vsdomains0_
DEBUG 05/16/2006 12:42:36 <ExecuteThread: '59' for queue: 'default'> <ast.tree.FromReferenceNode> Resolved : d -> vsdomains0_.ASSET_ID INFO 05/16/2006 12:42:36 <ExecuteThread: '59' for queue: 'default'> <com.verisign.dbms> <kshobhana-lnx.corpc.vrsn.com><DBMS><><DBMS-DBMS><><><EditAdminDNSProfileAction: Exception during Modify @loc#1org.hibernate.QueryException: could not resolve property: dns_profile_id of: VsDomains [from VsDomains d where d.dns_profile_id = :dns_profile_id]>ERROR 05/16/2006 12:42:36 <ExecuteThread: '59' for queue: 'default'> <dbms.common.DBMAction> <kshobhana-lnx.corpc.vrsn.com><DBMS><><execute><><DBMChainedException: could not resolve property: dns_profile_id of: VsDomains [from VsDomains d where d.dns_profile_id = :dns_profile_id]; nested exception is: org.hibernate.QueryException: could not resolve property: dns_profile_id of: VsDomains [from VsDomains d where d.dns_profile_id = :dns_profile_id]org.hibernate.QueryException: could not resolve property: dns_profile_id of: VsDomains [from VsDomains d where d.dns_profile_id = :dns_profile_id]
at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(Ljava.lang.String;)V(AbstractPropertyMapping.java:43) at org.hibernate.persister.entity.AbstractPropertyMapping.toType(Ljava.lang.String;)Lorg.hibernate.type.Type;(AbstractPropertyMapping.java:37) at org.hibernate.persister.entity.AbstractEntityPersister.toType(Ljava.lang.String;)Lorg.hibernate.type.Type;(AbstractEntityPersister.java:1265) at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(Ljava.lang.String;Ljava.lang.String;)Lorg.hibernate.type.Type;(FromElementType.java:279) at org.hibernate.hql.ast.tree.FromElement.getPropertyType(Ljava.lang.String;Ljava.lang.String;)Lorg.hibernate.type.Type;(FromElement.java:372)
at org.hibernate.hql.ast.tree.DotNode.getDataType()Lorg.hibernate.type.Type;(DotNode.java:539)
at org.hibernate.hql.ast.tree.DotNode.prepareLhs()Lorg.hibernate.type.Type;(DotNode.java:221)
at org.hibernate.hql.ast.tree.DotNode.resolve(ZZLjava.lang.String;Lantlr.collections.AST;)V(DotNode.java:172)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(ZZLjava.lang.String;)V(FromReferenceNode.java:94)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(ZZ)V(FromReferenceNode.java:90)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(Lantlr.collections.AST;)V(HqlSqlWalker.java:725)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(Lantlr.collections.AST;)V(HqlSqlBaseWalker.java:1215)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(Lantlr.collections.AST;)V(HqlSqlBaseWalker.java:4032)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(Lantlr.collections.AST;)V(HqlSqlBaseWalker.java:3518)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(Lantlr.collections.AST;)V(HqlSqlBaseWalker.java:1758)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(Lantlr.collections.AST;)V(HqlSqlBaseWalker.java:776)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(Lantlr.collections.AST;)V(HqlSqlBaseWalker.java:577)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(Lantlr.collections.AST;)V(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(Lantlr.collections.AST;)V(HqlSqlBaseWalker.java:229) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(Lorg.hibernate.hql.ast.HqlParser;Ljava.lang.String;)Lorg.hibernate.hql.ast.HqlSqlWalker;(QueryTranslatorImpl.java:218)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(Ljava.util.Map;ZLjava.lang.String;)V(QueryTranslatorImpl.java:158) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(Ljava.util.Map;Z)V(QueryTranslatorImpl.java:109) at org.hibernate.engine.query.HQLQueryPlan.<init>(Ljava.lang.String;Ljava.lang.String;ZLjava.util.Map;Lorg.hibernate.engine.SessionFactoryImplementor;)V(HQLQueryPlan.java:75) at org.hibernate.engine.query.HQLQueryPlan.<init>(Ljava.lang.String;ZLjava.util.Map;Lorg.hibernate.engine.SessionFactoryImplementor;)V(HQLQueryPlan.java:54) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(Ljava.lang.String;ZLjava.util.Map;)Lorg.hibernate.engine.query.HQLQueryPlan;(QueryPlanCache.java:71) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(Ljava.lang.String;Z)Lorg.hibernate.engine.query.HQLQueryPlan;(AbstractSessionImpl.java:133) at org.hibernate.impl.AbstractSessionImpl.createQuery(Ljava.lang.String;)Lorg.hibernate.Query;(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(Ljava.lang.String;)Lorg.hibernate.Query;(SessionImpl.java:1583)
I have been struggling on this for a while and have not found a wokring answer yet.
Thanks
S
_________________ Thanks
Last edited by shobhanakirtane on Tue May 16, 2006 3:53 pm, edited 1 time in total.
|