joins are handled automatically based on relationship-definitions and path-expressions
ie a PErson having 1:n Phones:
<class-descriptor
class="brj.ojb.Person"
table="tabPerson"
>
<field-descriptor id="1"
name="id"
.... <collection-descriptor
name="telefone"
orderby="nummer"
sort="DESC"
element-class-ref="brj.ojb.Telefon"
proxy="true"
refresh="false"
auto-retrieve="true"
auto-update="true"
auto-delete="true"
>
<inverse-foreignkey field-ref="idPerson"/>
</collection-descriptor> <class-descriptor
class="brj.ojb.Telefon"
table="tabTelefon"
>
...
<reference-descriptor
name="inhaber"
class-ref="brj.ojb.Person"
>
<foreignkey field-ref="idPerson"/>
</reference-descriptor>
</class-descriptor>the path expression 'telefone.nummer' will result in a join between tabPerson and tabTelefon
crit = new Criteria();
crit.addLike("telefone.nummer", "031*"); crit.addOrderByAscending("name");
query = new QueryByCriteria(Person.class, crit);
hth jakob
btw: query syntax is in the docs ;)
lyl wrote:
Hi, there!
I have several table to join, but i cannot find the api. Can any one
tell me? In addition, I want to select a value like "max(id)" from a
table, i say the QueryBySQL, but i am wondering if there is another way
to accomplish this, any way i don't like to mix SQL string in the
program.
thinks.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
