[ 
http://galaxy.andromda.org:8080/jira/browse/SPRING-49?page=comments#action_11175
 ]
     
Wouter Zoons commented on SPRING-49:
------------------------------------

what I'm doing in my projects is this:

I have a JSP with a form containing the search criteria, I have a checkbox 
where the user can choose to match the entered criteria strictly, or not. 
Unlike what you wrote earlier I personally never allowed the user to enter 
wildcards, I always restricted him with a predefined set op match modes 
(usually only 2 options).

anyway, this match mode flag is sent to be backend and the appropriate 
hibernate match mode is dynamically chosen

the default match mode (for example: the entered string may appear anywhere in 
the values found) is defined by the application, and can vary from criteria 
parameter to criteria parameter, so I don't let the user decide on this (most 
of the time this is not needed, the context in which the search is happening 
makes this clear: suppose you're looking for a person based on his name .. well 
in that case you'll want to use MatchMode.START because the user might not know 
the complete name, or might have forgotten how to write it, for example is it 
'Chad' or 'Chand' ? the user might just type 'Cha' to have all persons)

to tell hibernate to match 'urg' at the send of the value I do this:

if (StringUtils.isNotBlank(searchCriteria.getFirstName()))
  
personCriteria.add(Expression.ilike("firstName",searchCriteria.getFirstName(), 
MatchMode.END));

However, more complex match modes do not exist in Hibernate.


> criteria parameter: tagged value MatchMode for strings
> ------------------------------------------------------
>
>          Key: SPRING-49
>          URL: http://galaxy.andromda.org:8080/jira/browse/SPRING-49
>      Project: Spring Cartridge
>         Type: Improvement
>     Versions: 3.0RC1
>     Reporter: Wouter Zoons
>     Assignee: Peter Friese

>
>
> you might already have something in mind for this, but this way I can keep 
> track of this particular feature
> I'm using the match mode in most of my criteria queries

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://galaxy.andromda.org:8080/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel

Reply via email to