hi tim,
query by example is actually a query by id (i'll rename it)
for a minimal solution see QueryByCriteria(Object exampleObj);
hth
jakob
----- Original Message -----
From: "Gibbs, Tim" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 20, 2002 6:48 PM
Subject: QueryByExample not implemented???
I was just attempting to perform a QueryByExample and have found that the
QueryByExample object does not seem to have been completely implemented
because the "getCriteria" method just returns null.
Now my guess is that this should build Criteria from the example object
passed into the constructor but clearly that is not the case.
Is this mechanism actually working? It doesn't seem to be for me and I have
checked to make sure the object being passed in is non-null and has
attributes set. What I get back is ALL the rows of the table (as objects of
course). Sample code below
Thanks for any help.
Cheers,
Tim
PersistenceBroker broker = null;
try {
broker = PersistenceBrokerFactory.createPersistenceBroker(new
PBKey("my_repository.xml"));
Query query;
if(refIndex == null)
query = null;
else
query = new QueryByExample(refIndex);
Criteria crit = query.getCriteria();
return broker.getCollectionByQuery(query);
} catch (Throwable t) {
t.printStackTrace();
}
--------------------------------------------
Tim Gibbs
RBC Capital Markets
Phone: (416) 842-4663
E-Mail: [EMAIL PROTECTED]
<font face="Times New Roman" size="3">
<p>-------------------------------------------------------------------------
-----</p>
<p> This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in error,
please advise me (by return e-mail or otherwise) immediately.</p>
<p> Ce courriel est confidentiel et prot�g�. L'exp�diteur ne renonce pas aux
droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou
copie de ce message ou des renseignements qu'il contient par une personne
autre que le (les) destinataire(s) d�sign�(s) est interdite. Si vous recevez
ce courriel par erreur, veuillez m'en aviser imm�diatement, par retour de
courriel ou par un autre moyen.</p>
<p>====================================================</p>
</font>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>