Thanks to 2 my collegues, I've solved the problem using an SQLTemplate query
instead of a SelectQuery. Here the code:
SQLTemplate sqlquery = new SQLTemplate(
Name.class,
"SELECT names.* FROM names JOIN "
+ "("
+ " SELECT DISTINCT COALESCE (parent,uid) AS uid FROM names WHERE
name ILIKE '" + stext + "' "
+ ") AS NamesFound "
+ "ON names.uid=NamesFound.uid ORDER BY names.name",
true
);
where "names" is the table mapped to Name.class.
Claudio
Multimedia <http://www.acsys.it/> Division
Claudio Rosati
Project Manager Advanced Computer Systems S.p.A.
via Della Bufalotta 378
00139 Roma, RM
Italy
claudio.rosat..csys.it
tel:
fax: +39 06 8709 0516
+39 06 8720 1502
<http://www.plaxo.com/signature> Signature powered by Plaxo
<http://www.plaxo.com/signature> Want a signature like this?
<https://www.plaxo.com/add_me?u=4295038861&v0=140354&k0=586510396> Add me
to your address book...
This archive was generated by hypermail 2.0.0 : Wed Aug 25 2004 - 06:14:51 EDT