-->
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.  [ 1 post ] 
Author Message
 Post subject: [SOLVED] org.hibernate.QueryException: could not resolve
PostPosted: Wed Apr 25, 2007 5:38 am 
Newbie

Joined: Thu Mar 22, 2007 6:50 am
Posts: 6
Edit: I made a stupid typo so please ignore this thread! Thanks

Hello,

I could use a little help with a named query I'm having trouble with. The objects involved are defined as follows:

Code:
<class name="List" table="list">
<id name="id" type="long" column="id" unsaved-value="0">
<generator class="increment" />
</id>
<many-to-one name="a" class="ListItem" column="a_id" />
<many-to-one name="b" class="ListItem" column="b_id" />
</class>

<class name="ListItem" table="list_item">
<id name="id" type="long" column="id" unsaved-value="0">
<generator class="increment" />
</id>
<property name="refId" type="string" column="ref_id" not-null="true" />
</class>


I'd like to count the List objects who's a's id = "some value" OR who's b's id = "some value". So if either a's id or b's id matches the id passed in as a parameter, I want the List to be returned (or actually the count of the List to be returned).

I have the following named query:

Code:
<query name="List.countListItemsWithId">
<![CDATA[select count(x) from List as x where x.a.id=:listItemId or x.b.id=:listItemId]]>
</query>


But I'm getting the following error:

ERROR [SessionFactoryImpl] Error in named query: List.countListItemsWithId
org.hibernate.QueryException: could not resolve property: listItemId of: ListItem

Anybody have an idea how to solve that? I know that listItemId is not a property of ListItem, but listItemId is just the named parameter - not sure why named parameters must match propery names???

Many thanks![/b]


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

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.