Hi Dain,
I got the error message when using this command:
SELECT Object(r) FROM Role as r WHERE UCASE(r.roleDesc)
LIKE CONCAT(UCASE(?1),'%')
09:21:35,125 WARN [ServiceController] Problem starting service
jboss.j2ee:servi
ce=EJB,jndiName=RoleRemoteHome
org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested
throwa
ble: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "ucase"
at lin
e 1, column 39.
Was expecting one of:
"NOT" ...
"(" ...
<COLLECTION_VALUED_PATH> ...
<STRING_VALUED_PATH> ...
"CONCAT" ...
"SUBSTRING" ...
<BOOLEAN_VALUED_PATH> ...
<DATETIME_VALUED_PATH> ...
<ENTITY_VALUED_PATH> ...
<IDENTIFICATION_VARIABLE> ...
<NUMERIC_VALUED_PATH> ...
"LENGTH" ...
"LOCATE" ...
"ABS" ...
"SQRT" ...
"+" ...
"-" ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<NUMERIC_VALUED_PARAMETER> ...
)
But when I remove the UCASE command, I got anther error message:
SELECT Object(r) FROM Role as r WHERE r.roleDesc LIKE
CONCAT(?1,'%')
09:29:54,153 WARN [ServiceController] Problem starting service
jboss.j2ee:servi
ce=EJB,jndiName=RoleRemoteHome
org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested
throwa
ble: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "CONCAT"
at li
ne 1, column 55.
Was expecting:
<STRING_LITERAL> ...
)
Any suggestion or comment?
Thanks,
-phu
Dain Sundstrom
<[EMAIL PROTECTED]> To:
[EMAIL PROTECTED]
Sent by: cc:
[EMAIL PROTECTED] Subject: Re: [JBoss-user]
EJB-QL For LIKE
eforge.net
No Phone Info Available
09/23/2002 09:56 PM
Please respond to jboss-user
Anthony Geoghegan wrote:
> EJB-QL does not support like statements with input parameters:
> It's to do with CMP field's data type not being known till runtime. Thus
the
> like comparison can only be used on string literals
Not really. The spec guys wanted to support feature poor (i.e., crappy)
datastores, so they crippled EJB-QL. Parameters in LIKE clauses will be
supported in EJB 2.1.
> Example:
>
> SELECT OBJECT(o) FROM Orders AS o WHERE o.customer LIKE '%Bloggs%'
> See no input parameters.
>
> However JBossQL and certainly DeclaredSQL may provide a better avenue for
> you to pursue if this is what you want.
You can do this today in JBossQL. I would guess you want something like
this:
SELECT Object(t)
FROM tableName t
WHERE UCASE(t.firstName) LIKE CONCAT(UCASE(?1), '%')
-dain
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user