Hello.
I have a class called SubscriptionBean...It has two keys - partyID and contentID. My mapping is shown below:
<class name="com.ci.db.member.SubscriptionBean" table="SUBSCRIPTION">
<composite-id>
<key-property name="partyID" type="long" >
<column name="PARTY_ID" sql-type="integer" not-null="false"/>
</key-property>
<key-property name="contentID" type="integer" >
<column name="CONTENT_ID" sql-type="integer" not-null="false"/>
</key-property>
</composite-id>
<property name="subscribed">
<column name="SUBSCRIBED" sql-type="integer" not-null="true"/>
</property>
</class>
(I assume my usage of composite-id is correct?)
Next I wrote a named query to access SubscriptionBean. Essentially it joins the subscription table with the party table:
<sql-query name="subscribedContentQuery">
<return alias="sub" class="com.ci.db.member.SubscriptionBean"/>
select {sub}.party_id as {sub.partyID},
{sub}.content_id as {sub.contentID},
{sub}.subscribed as {sub.subscribed}
from SUBSCRIPTION sub, PARTY
where PARTY.PARTY_ID = sub.PARTY_ID
and PARTY.USERNAME = ?
</sql-query>
When I execute this query, I get the following error:
net.sf.hibernate.QueryException: No column name found for property [partyID]....
Just for kicks, I changed my mapping to not use a composite key (I set partyID as the lone key) and it worked fine.
So, do I have to change the wording in my query when there is a composite key?
Thanks for your time!
chris
|