cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: AS400 mapping error
Date Wed, 14 Feb 2007 15:13:08 GMT
Yeah, expression parser can't cope with special chars. But you can  
always assemble the expression by hand:

Expression e = ExpressionFactory.matchDbExp 
(Bsypemp.EMHSPPOUND_PK_COLUMN, new Integer(1));
e = e.andExp(ExpressionFactory.likeExp(Bsypemp.EMYLNM_PROPERTY, lname 
+"%"));

Andrus


On Feb 14, 2007, at 10:02 AM, Frank wrote:

> Why do I get this error?
>
> Lexical error at line 1, column 6. Encountered: "#" (35), after : ""
> Expression expression = Expression.fromString 
> (Bsypemp.EMHSPPOUND_PK_COLUMN +" = 1 and EMYLNM LIKE $lastName");
>
> Map parameters = new HashMap(1);
>
> parameters.put("lastName", lname+"%");
>
> SelectQuery query = new SelectQuery 
> (Bsypemp.class,expression.expWithParameters(parameters));
>


Mime
View raw message