[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1682) query restriction example: in ejbql the use of + operator appears to be wrong
Wolfgang Schwendt (JIRA)
jira-events at lists.jboss.org
Mon Jul 16 16:39:47 EDT 2007
[ http://jira.jboss.com/jira/browse/JBSEAM-1682?page=comments#action_12369132 ]
Wolfgang Schwendt commented on JBSEAM-1682:
-------------------------------------------
correction:
<framework:restrictions>
<value>lower(firstName) like lower(concat ( #{examplePerson.firstName} , '%' ))</value>
<value>lower(lastName) like lower(concat( #{examplePerson.lastName} , '%' ))</value>
</framework:restrictions>
> query restriction example: in ejbql the use of + operator appears to be wrong
> -----------------------------------------------------------------------------
>
> Key: JBSEAM-1682
> URL: http://jira.jboss.com/jira/browse/JBSEAM-1682
> Project: JBoss Seam
> Issue Type: Bug
> Components: Documentation
> Environment: Seam2.0.0.B1
> MySQL5.0.27
> Reporter: Wolfgang Schwendt
> Priority: Trivial
> Fix For: 2.0.0.BETA1
>
>
> The Seam reference manual, chapter "The Seam Application Framework", section "Query Objects", contains an example how one can specify optional restrictions for a query. More precisely, an XML definition of an EntityQuery component named "people" is shown. Two restrictions are defined, and it appears that the use of the + operator in these restrictions is wrong. In these restriction definitions the use of the + operator is intended for string concatenation, but according to JSR 220/EJB Persistence specification V.3.0 Final Release, the + operator is only listed in the category "arithmetic operators". At least when tested with Seam2.0.0B1 and MySQL, these restrictions (with the + operator) don't work as expected.
> Solution: replace the + operator by the concat() function as follows:
> <framework:entity-query name="people"
> ejbql="select p from Person p"
> order="lastName"
> max-results="20">
> <framework:restrictions>
> <value>lower(firstName) like lower(concat ( #{examplePerson.firstName} , '%' ))</value>
> <value>lower(lastName) like lower(concat( #{examplePerson.lastName} + '%' ))</value>
> </framework:restrictions>
> </framework:entity-query>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list