RE: Criteria.addSelectColumn problem
Thomas Fischer <[email protected]>
| Newsgroups | gmane.comp.jakarta.turbine.torque.user |
|---|---|
| Message-ID | <OF42FBD8C3.5D32882B-ONC12574AD.006C03A5-C12574AD.006C8317@seitenbau.net> |
> 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