db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Criteria.addSelectColumn problem
Date Fri, 22 Aug 2008 19:45:13 GMT
> crit.add (c2, 3333)
> crit.addSelectColumn (c3)
> crit.setDistinct();
> Iterator results = t3Peer.doSelect(crit).iterator() 
> 
> would throw Exception at doSelect() because during the 
> populateObject(), it found only 1 column instead of all columns as 
> default to populate the data into it. 

Alternatice to Carl's answer:
If you want the complete objects instead of just the values of c3, xou 
want to use a subselect. You express the condition in the subselect, and 
then select all the objects in the outer select. Like

innercrit.add (c2, 3333)
innercrit.addSelectColumn (c3)
innercrit.setDistinct();
crit.add(c2, 3333);
crit,add(c3, innercrit);
Iterator results = t3Peer.doSelect(crit).iterator();

Hope this works (have not tried it), but in principle it is possible.

   Thomas
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message