That's a very good idea, I'll try this today and see if it works.
Thank you.

Laurent.


Le 05/16/2011 05:03 PM, Mike Kienenberger a écrit :
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<[email protected]>  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.

Reply via email to