hi mike,

i cannot confirm this behaviour. this testcase:

        // 1.) sql only
        crit = new Criteria();
        crit.addSql("upper(firstname) = 'TOM' and id = 1");
        q = QueryFactory.newQuery(Person.class, crit);
        results = broker.getCollectionByQuery(q);

        // 2.) sql plus attribute
        crit = new Criteria();
        crit.addSql("upper(firstname) = 'TOM'");
        crit.addEqualTo("id",new Integer(1));
        q = QueryFactory.newQuery(Person.class, crit);
        results = broker.getCollectionByQuery(q);

        // 3.) attribute plus sql
        crit = new Criteria();
        crit.addEqualTo("upper(firstname)","TOM");
        crit.addSql("id = 1");
        q = QueryFactory.newQuery(Person.class, crit);
        results = broker.getCollectionByQuery(q);

produces the following correct sql:

1.)
SELECT A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM PERSON A0 WHERE upper(firstname) = 'TOM' and id = 1


2.)
SELECT A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM PERSON A0 WHERE (upper(firstname) = 'TOM') AND A0.ID = '1'


3.)
SELECT A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM PERSON A0 WHERE (upper(A0.FIRSTNAME) = 'TOM') AND id = 1



jakob


Jakob Braeuchi schrieb:
hi mike,

i'll check this problem asap.

jakob

Mike Young schrieb:

Not sure whether this is a bug, and if so how to report it?

When using criteria.addSql("col LIKE 'Some String'") the string gets added
twice as the criteria and the criteria looks like ... [col LIKE 'Some String'nullcol LIKE 'Some String']


I am using OJB1.0.0


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



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



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



Reply via email to