Hi,
I apologize for the repost, but I thought I'd try to simplify my question. I'm trying to use the criteria API to perform the quivalent of the following HQL query:
Code:
Query query = session.createQuery("select l from Listing l join l.areas area where area in (:areas)");
query.setParameterList("areas", areas, Hibernate.entity(Area.class));
return query.list();
There is a unidirectional many-to-many relationship between Listing and Area. Is this possible with the criteria API in Hibernate 2.1.8? I've tried too many combinations to list with no success. I don't want to burden the list with all of the combinations and relavent stacktraces if this isn't possible. If it is not possible with 2.1.8, is it possible with Hibernate3?
Thanks in Advance!
Hibernate version: 2.1.8
Mapping documents:Code:
<hibernate-mapping>
<class name="Listing" table="LISTING">
<id name="id" column="LISTING_ID" type="int">
<generator class="seqhilo">
<param name="sequence">LISTING_SEQ</param>
<param name="max_lo">25</param>
</generator>
</id>
<set name="areas" lazy="false" table="LISTING_AREA">
<key column="LISTING_ID"/>
<many-to-many class="Area" column="AREA_ID"/>
</set>
</class>
</hibernate-mapping>
<hibernate-mapping package="com.cleanoffer.domain.mls">
<class name="Area" table="AREA">
<id name="id" column="AREA_ID">
<generator class="assigned"/>
</id>
</class>
</hibernate-mapping>