Criteria concat fields

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Criteria concat fields

Houcem Berrayana
Hi,
I have a user domain that has a firstName and lastName fields.
I have a very complicated search form that searches user domain and some related domains.
In the same search form i have a name input field in which the user can type the user's full name .. so I have to search for "${firstName} ${lastName}" and not for firstNAme and lastName each one alone.

Is there any way to use concat  function in the criteria queries ? And how can we use native SQL (MySQL) functions through criteria ?

PS: I don't want to switch to HQL because a lot of work has already been done.

Thanks
Regards
Reply | Threaded
Open this post in threaded view
|

Re: Criteria concat fields

bond_

You can do so using sqlRestriction in criteria. Please refer to criteria's documentation

On Sep 18, 2012 10:25 PM, "Houcem Berrayana" <[hidden email]> wrote:
Hi,
I have a user domain that has a firstName and lastName fields.
I have a very complicated search form that searches user domain and some
related domains.
In the same search form i have a name input field in which the user can type
the user's full name .. so I have to search for "${firstName} ${lastName}"
and not for firstNAme and lastName each one alone.

Is there any way to use concat  function in the criteria queries ? And how
can we use native SQL (MySQL) functions through criteria ?

PS: I don't want to switch to HQL because a lot of work has already been
done.

Thanks
Regards



--
View this message in context: http://grails.1312388.n4.nabble.com/Criteria-concat-fields-tp4635070.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email