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 Christine Gerstenmayer <ch...@chello.at> on 2005/07/02 07:11:02 UTC

Howto do this with OJB 1.0.1 (ESCAPE and escape-signs)

Because I do not find my question asked on 2005-06-30 in mail-archive
(although questions from 2005-07-01 are already there) I try it once more:

Hi all,

please can you help me with this case ?

I want OJB to generate a sqlstatement like this:

 
SELECT *
FROM AdminLog A0 INNER JOIN CPMUser A1 ON A0.FK_UserID=A1.PK_UserID
WHERE (((A1.FK_InstituteID = ,xxx')
AND A1.Branch LIKE ,ABC\_XYZ' ESCAPE ,\')
AND A0.LoginTimestamp >= ,20005-06-30 12:30:04)
AND A0.LoginTimestamp <= ,2005-06-30 13:04:02'
ORDER BY 1

AdminLog has a reference-descriptor to CPMUser via UserID and CPMUser has a
reference-descriptor to Institute via InstituteID. Branch is a column of
CPMUser

The Problem ist the escapesign and the word ESCAPE

I tried it without ESCAPE:

        Criteria c = new Criteria();
        c.addEqualTo("ref_FK_AdminLog_CPMUser.ref_FK_User_Institute." +
Institute.getpk_instituteidSQLName(), instituteId);
        c.addLike("ref_FK_AdminLog_CPMUser." + CPMUser.getbranchSQLName(),
branch);
        c.addGreaterOrEqualThan(AdminLog.getlogintimestampSQLName(),
fromDate);
        c.addLessOrEqualThan(AdminLog.getlogintimestampSQLName(), toDate);
        return AbstractPersistency.selectOrderedByCriteria( AdminLog.class,
c,
                                                            new
String[]{AdminLog.getlogintimestampSQLName()},
                                                            new
boolean[]{true});


Works fine, if there is no branch "ABC1XYZ" or so, but how do I get ESCAPE
into this statement ??

Please help.

Thanks in advance

Christine



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org