I'm working on a new project, and it's the first time I've needed to deal with a legacy database in hibernate. We have a composite key that includes two columns.. like so:
<composite-id> <key-property name="id" column="id"/> <key-property name="siteId" column="site_id"/> </composite-id>
Problem is... this HQL query doesn't work: "from MyEntity where siteId=?"
Hibernate complains that it can't resolve the siteId property of MyEntity. I can't find this limitation called out in the documentation though. Is there a way to expose the properties used for composite-id as columns that can be searched on in HQL? I can't think of a good reason for this limitation, so I'm stumped.
Anyone know more about this?
Thanks in advance, Phill
|