-->
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: Can I do this HQL query with the Criteria API?
PostPosted: Wed Mar 09, 2005 4:46 pm 
Newbie

Joined: Mon Mar 07, 2005 10:31 pm
Posts: 3
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>


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.