EJBQL doesn't support string_expressions (a.k.a input parameters) in 
LIKE statements.  A string_literal is a hardcoded 'string'.  This is a 
huge limitation to EJBQL, and as I understand it EJB 2.1 spec has this 
feature added.

It is also my understanding that JBossQL supports this, along with the 
UCASE function (which also isn't supported by EJBQL).

In our project, we resorted to writing SQL statements for queries that 
required case insensitive wildcard searches.  (We did this since we are 
*required* to develop to the spec., so JbossQL was not an option for now.

Hope this helps.
Mike

[EMAIL PROTECTED] wrote:
> Hi Alex,
> 
> I use JBoss version 3.0.2
> 
> 09:48:35,035 INFO  [MainDeployer] Deployed package:
> file:/C:/jboss-3.0.2/server/
> default/deploy/OraTest.ear
> 
> -phu
> 
> 
> 
>                                                                                      
>                                             
>                     Alex Loubyansky                                                  
>                                             
>                     <[EMAIL PROTECTED]>                  To:     
>"[EMAIL PROTECTED]"                               
>                     Sent by:                            
><[EMAIL PROTECTED]>                                        
>                     [EMAIL PROTECTED]        cc:                          
>                                             
>                     eforge.net                          Subject:     Re[2]: 
>[JBoss-user] EJB-QL For LIKE                          
>                     No Phone Info Available                                          
>                                             
>                                                                                      
>                                             
>                     09/24/2002 01:01 PM                                              
>                                             
>                     Please respond to jboss-user                                     
>                                             
>                                                                                      
>                                             
>                                                                                      
>                                             
> 
> 
> 
> 
> Hello Phuwarin,
> 
> what JBoss version are you using? Looks like it misses these
> functions.
> 
> alex
> 
> Tuesday, September 24, 2002, 5:50:13 AM, you wrote:
> PSsc> Hi Dain,
> 
> PSsc> I got the error message when using this command:
> PSsc>                 SELECT Object(r) FROM Role as r WHERE
> UCASE(r.roleDesc)
> PSsc> LIKE CONCAT(UCASE(?1),'%')
> 
> PSsc> 09:21:35,125 WARN  [ServiceController] Problem starting service
> PSsc> jboss.j2ee:servi
> PSsc> ce=EJB,jndiName=RoleRemoteHome
> PSsc> org.jboss.deployment.DeploymentException: Error compiling ejbql; -
> nested
> PSsc> throwa
> PSsc> ble: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered
> "ucase"
> PSsc> at lin
> PSsc> e 1, column 39.
> PSsc> Was expecting one of:
> PSsc>     "NOT" ...
> PSsc>     "(" ...
> PSsc>     <COLLECTION_VALUED_PATH> ...
> PSsc>     <STRING_VALUED_PATH> ...
> PSsc>     "CONCAT" ...
> PSsc>     "SUBSTRING" ...
> PSsc>     <BOOLEAN_VALUED_PATH> ...
> PSsc>     <DATETIME_VALUED_PATH> ...
> PSsc>     <ENTITY_VALUED_PATH> ...
> PSsc>     <IDENTIFICATION_VARIABLE> ...
> PSsc>     <NUMERIC_VALUED_PATH> ...
> PSsc>     "LENGTH" ...
> PSsc>     "LOCATE" ...
> PSsc>     "ABS" ...
> PSsc>     "SQRT" ...
> PSsc>     "+" ...
> PSsc>     "-" ...
> PSsc>     <INTEGER_LITERAL> ...
> PSsc>     <FLOATING_POINT_LITERAL> ...
> PSsc>     <NUMERIC_VALUED_PARAMETER> ...
> PSsc>     )
> 
> PSsc> But when I remove the UCASE command, I got anther error message:
> PSsc>                 SELECT Object(r) FROM Role as r WHERE r.roleDesc LIKE
> PSsc> CONCAT(?1,'%')
> 
> PSsc> 09:29:54,153 WARN  [ServiceController] Problem starting service
> PSsc> jboss.j2ee:servi
> PSsc> ce=EJB,jndiName=RoleRemoteHome
> PSsc> org.jboss.deployment.DeploymentException: Error compiling ejbql; -
> nested
> PSsc> throwa
> PSsc> ble: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered
> "CONCAT"
> PSsc> at li
> PSsc> ne 1, column 55.
> PSsc> Was expecting:
> PSsc>     <STRING_LITERAL> ...
> PSsc>     )
> 
> PSsc> Any suggestion or comment?
> 
> PSsc> Thanks,
> PSsc> -phu
> 
> 
> 
> PSsc>                     Dain Sundstrom
> PSsc>                     <[EMAIL PROTECTED]>                To:
> [EMAIL PROTECTED]
> PSsc>                     Sent by:                            cc:
> PSsc>                     [EMAIL PROTECTED]        Subject:
> Re: [JBoss-user] EJB-QL For LIKE
> PSsc>                     eforge.net
> PSsc>                     No Phone Info Available
> 
> PSsc>                     09/23/2002 09:56 PM
> PSsc>                     Please respond to jboss-user
> 
> 
> 
> 
> 
> 
> PSsc> 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
>>
> PSsc> the
> 
>>>like comparison can only be used on string literals
>>
> 
> PSsc> Not really.  The spec guys wanted to support feature poor (i.e.,
> crappy)
> PSsc> datastores, so they crippled EJB-QL.  Parameters in LIKE clauses will
> be
> PSsc> 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.
>>
> 
> PSsc> You can do this today in JBossQL.  I would guess you want something
> like
> PSsc> this:
> 
> PSsc> SELECT Object(t)
> PSsc> FROM tableName t
> PSsc> WHERE UCASE(t.firstName) LIKE CONCAT(UCASE(?1), '%')
> 
> PSsc> -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


-- 
<Mike/>




-------------------------------------------------------
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

Reply via email to