I come across the following situation with PersistenceBroker queries:

Here is my object
public class Customer {
    ...
    private List acls = new Vector();
    private String realm = "...";
}

acls is a collection with Acl as collection member.

This is the query

Criteria crit = new Criteria();
crit.addEqualTo( "oid", new Long(201));
crit.addLike( "realm", "/201*" );
Criteria or = new Criteria();
or.addEqualTo( "acls.user_FK", new Long( 1 ) ); // notice the reference
field
crit.addOrCriteria( or );

Resulting sql statement is:
SELECT ... FROM customers A0 INNER JOIN acls A1 ON A0.cus_oid=A1.acl_eid
WHERE (A0.cus_oid =  '201' ) AND A0.cus_realm LIKE  '/201%'  OR  (A1.acl_uid
IN ( '1' ))

The sql statement comes out quite well constructed, except for one thing. It
uses inner join which means that my OR condition in which I refer to a
reference field effectually becomes an AND condition. Shouldn't the
statement contain rather left join in this case?

Cheers,
--Bill.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to