[
https://issues.jboss.org/browse/FORGE-1201?page=com.atlassian.jira.plugin...
]
George Gastaldi updated FORGE-1201:
-----------------------------------
Status: Closed (was: Pull Request Sent)
Fix Version/s: 2.0.1.Final
(was: 2.x Future)
Resolution: Done
getSearchPredicates should use case insensitive search
------------------------------------------------------
Key: FORGE-1201
URL:
https://issues.jboss.org/browse/FORGE-1201
Project: Forge
Issue Type: Feature Request
Affects Versions: 1.4.0.Final
Reporter: Antonio Goncalves
Assignee: Antonio Goncalves
Fix For: 2.0.1.Final
Hi,
When you do JSF scaffolding, the generated code for research is as follow :
{code}
private Predicate[] getSearchPredicates(Root<Talk> root) {
CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
List<Predicate> predicatesList = new ArrayList<>();
String title = this.example.getTitle();
if (title != null && !"".equals(title)) {
predicatesList.add(builder.like(root.<String>get("title"),
'%' + title + '%'));
}
{code}
The problem with that is the search is case sensitive and searching for "java"
or "Java" doesn't bring the same results. It would be more natural to have
case insensitive search as follow :
{code}
private Predicate[] getSearchPredicates(Root<Talk> root) {
CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
List<Predicate> predicatesList = new ArrayList<>();
String title = this.example.getTitle();
if (title != null && !"".equals(title)) {
predicatesList.add(builder.like(builder.lower(root.<String>get("title")),
"%" + title.toLowerCase() + "%"));
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira