{fn ucase} is JDBC escape syntax, so presumably the driver should convert that 
to the proper syntax. If a given driver is not capable of doing that, that has 
to be addressed in DbAdapter for that DB. DbAdapter.getEjbqlTranslatorFactory() 
is how you customize EJBQL translation. So Mike is right about that.

BTW, which DB are we talking about?

Andrus


> On Oct 13, 2015, at 5:31 AM, Hugi Thordarson <h...@karlmenn.is> wrote:
> 
> Thanks Mike!
> 
> I’m not sure it this is a database plugin problem though. Doing regular case 
> insensitive queries works fine, it’s only queries created from EJBQL that 
> fail. Also, the only place in the Cayenne sources I can find a mention of 
> “ucase" is in EJBQLTranslator’s visitUpper(). Perhaps changing that method to 
> do upper( rather than {fn ucase. might solve the problem? I’m going to try 
> that out :).
> 
> https://github.com/apache/cayenne/blob/master/cayenne-server/src/main/java/org/apache/cayenne/access/translator/ejbql/EJBQLConditionTranslator.java#L1058
> 
> Cheers,
> - hugi
> 
> 
> 
> 
>> Sounds like the DbAdaptor for that database needs to be special-cased.
>> Lots of examples of how this is done in cayenne/dba/<database>/*,
>> especially for oracle
>> 
>> And it's pretty simple to set your app up to use a custom version of
>> the dbAdaptor if you don't want to build your own custom version of
>> cayenne while you wait until it's included in a release.
>> 
>> On Mon, Oct 12, 2015 at 12:46 PM, Hugi Thordarson <h...@karlmenn.is> wrote:
>>> Hi all.
>>> 
>>> I’m communicating with a database that doesn’t have the UCASE function, 
>>> only UPPER.
>>> 
>>> When I use case insensitive expressions (for example, 
>>> User.NAME.likeIgnoreCase(“Bob”)) in a regular SelectQuery, Cayenne 
>>> generates SQL using the “UPPER” function (for expressions generated using 
>>> likeIgnoreCase). This works fine.
>>> 
>>> But if I generate EJBQL from the expression and then use the resulting 
>>> string to perform an EJBQLQuery, Cayenne will attempt to use UCASE function 
>>> in the resulting SQL and things go awry.
>>> 
>>> Can I tell the EJBQL SQL translator to use “upper” rather than “ucase” when 
>>> performing these queries?
>>> 
>>> Cheers,
>>> - hugi
> 
> 

Reply via email to