-->
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.  [ 2 posts ] 
Author Message
 Post subject: composite id hql or criteria query matching a list
PostPosted: Tue Sep 05, 2006 11:26 am 
Beginner
Beginner

Joined: Thu Dec 11, 2003 12:02 pm
Posts: 23
Have a class with a composite id.

Code:
<class name="com.trumpsq.Overlayimagehotspot" table="overlayimagehotspot" catalog="trumpsquare">
        <composite-id name="id" class="com.trumpsq.OverlayimagehotspotId">
            <key-property name="idImage" type="java.lang.Integer">
                <column name="idImage" />
            </key-property>
            <key-property name="idOverlay" type="java.lang.Integer">
                <column name="idOverlay" />
            </key-property>
        </composite-id>
.
.
.
.



Need to get all overlayimagehotspots with composite id in a list of composite id's. Essentially need this:

SELECT * FROM trumpsquare.overlayimagehotspot o where (o.idImage, o.idOverlay) in ( (2,1),(14,2) )


Tried the following code:

Code:
List idOverlayList = Arrays.asList(idOverlay);
         Session session = dao.getHibernateTemplate().getSessionFactory().getCurrentSession();
         Query q = session.createQuery("from Overlayimagehotspot oihs where (oihs.id.idOverlay, oihs.id.idImage) in (:idOverlayList)");
         q.setParameterList("idOverlayList", idOverlayList);
//idOverlayList is a list of object type OverlayimagehotspotId
          List results = q.list();


This does not work. Exception.
Code:
ErrorCounter.reportError(28) | <AST>:0:0: unexpected AST node: {vector}
<AST>:0:0: unexpected AST node: {vector}


Does anyone know how to make this sql query work in hql or criteria query:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 5:14 pm 
Newbie

Joined: Tue Aug 08, 2006 3:50 pm
Posts: 4
any luck with this

i am having the same problem


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

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.