cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@gmail.com>
Subject Re: SQLTemplate Velocity lexical error
Date Mon, 16 May 2011 22:03:39 GMT
I haven't used it in an SQL Template, but in the past, I've escaped #s
like this:

#set($hash = '#')${hash} -- not sure if this works in an SQL template.

Often, though, Velocity is smart enough to use the character as is if
it's not escaped at all.

So 'Test_*@#' would probably work fine without escaping.

On Mon, May 16, 2011 at 4:35 PM, Laurent Marchal <lmarchal@smausa.com> wrote:
> Hi,
>
>    I am using a simple SQLTemplate select query but it fails because of
> special charachters :
>
> SELECT * FROM SDEPTHR  INNER JOIN THRESH ON SDEPTHR.DEPTHRID=THRESH.THRESHID
>  WHERE SDEPTHR.JOBNAME = 'Test_*@\#*'
>
> Error returned :
> [v.3.0.1 Aug 25 2010 19:58:47] Error parsing template 'SELECT * FROM SDEPTHR
>  INNER JOIN THRESH ON SDEPTHR.DEPTHRID=THRESH.THRESHID  WHERE
> SDEPTHR.JOBNAME = 'Test_*@\#*'' : Lexical error:
> org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 1,
> column 115.  Encountered: <EOF> after : ""
>
> It looks like the '#*' is the problem but I can't find a way to properly
> escape those characters
> <http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#stringliterals>.
> I know using the SQLTemplate parameters would solve this problem but I can't
> do that.
> Is there a way to tell cayenne to not parse the query with velocity or to
> escape properly the query ?
>
> Thank you.
> Laurent.
>

Mime
View raw message