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: