-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: QueryException: path expression
PostPosted: Thu Nov 09, 2006 7:03 am 
Newbie

Joined: Thu Nov 09, 2006 6:49 am
Posts: 1
When I try to get the composite key for a table using a simple query. I get the following error


1) testGetTemplate(TestGroupUser)org.hibernate.QueryException: path expression ends in a composite value: template0_.id [from com.narval.util.dbutil.dao.Templat
e d where d.id= ? ]
at org.hibernate.hql.classic.PathExpressionParser.getWhereColumn(PathExp
ressionParser.java:389)
at org.hibernate.hql.classic.WhereParser.doPathExpression(WhereParser.ja
va:363)
at org.hibernate.hql.classic.WhereParser.doToken(WhereParser.java:382)
at org.hibernate.hql.classic.WhereParser.token(WhereParser.java:263)
at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:86)
at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingPars
er.java:108)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslator
Impl.java:192)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslator
Impl.java:168)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCa
che.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessio
nImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImp
l.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at TestGroupUser.testGetTemplate(TestGroupUser.java:466)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at TestGroupUser.main(TestGroupUser.java:90)

FAILURES!!!

My Hibernate version: 3.0.1

My code

TemplateCompositeKey tempKeyID = new TemplateCompositeKey("a","b");
Template tempID = new Template(tempKeyID );
Session session = HibernateUtil.getSession();
Query q = session .createQuery("from Template d where d.id= ? ");
q.setParameter(1, tempID);
templ = (Template) q.list().get(0);
System.out.println("template Name is "+templ.getName());

session.close();



My hbm mapping

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Oct 19, 2006 3:45:43 PM by Hibernate Tools 3.2.0.beta6a -->
<hibernate-mapping>
<class name="com.narval.util.dbutil.dao.Template" table="T_TEMPLATE_NRVL" schema="BHFM">

<composite-id name="id" class="com.narval.util.dbutil.dao.CompositeTemplate">
<key-property name="templateId" type="string">
<column name="TEMPLATE_ID" length="10" />
</key-property>
<key-property name="templateVer" type="string">
<column name="TEMPLATE_VER" length="10" />
</key-property>
</composite-id>

<property name="name" type="string">
<column name="NAME" length="200" />
</property>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: QueryException: path expression
PostPosted: Fri Nov 17, 2006 9:10 am 
Newbie

Joined: Thu Nov 16, 2006 5:42 am
Posts: 1
Could you find a solution? Because I have the same problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.