You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Andrei Harangus <an...@travelmaster.com> on 2007/03/23 16:18:19 UTC
Simple query
Having the following class:
class Clazz {
private String field1;
private String field2;
}
Mapped to
table tbl1(field1, field2)
What is the code snippet that would generate the sql
select * from tbl1 where field1 = field2
Regards,
Andrei
Re: Simple query
Posted by Armin Waibel <ar...@apache.org>.
Hi Andrei,
Andrei Harangus wrote:
> Having the following class:
>
>
> class Clazz {
> private String field1;
> private String field2;
> }
>
> Mapped to
>
> table tbl1(field1, field2)
>
> What is the code snippet that would generate the sql
> select * from tbl1 where field1 = field2
>
Criteria crit = new Criteria().addEqualToField("field1", "field2"); ***
QueryByCriteria q = QueryFactory.newQuery(Clazz.class, crit);
q.setDistinct(true);
Collection result = broker.getCollectionByQuery(q);
(***) it's based on latest version from SVN (OJB_1_0_RELEASE branch),
maybe you have use crit.addEqualToField("field1", "field2").
regards,
Armin
> Regards,
> Andrei
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org