I have a project based in Spring Web model-view-controller (MVC) framework. The version of the Spring Web model-view-controller (MVC) framework is 3.2.8.
I have this method in my DAO
@Override
public List<Application> findByQuickSearch(String searchString) {
final StringBuilder queryString = new StringBuilder(" select app from Application app where upper (ticket_id) like :searchString or upper (id) like :searchString " );
queryString.append(" and app.status != " + Status.DRAFT.ordinal());
queryString.append(" order by app.submissionTime desc ");
try {
final Query query = getEntityManager().createQuery(queryString.toString());
searchString = searchString.replace("!", "!!")
.replace("%", "!%")
.replace("_", "!_")
.replace("[", "![")
.trim()
.toUpperCase();
System.out.println ("searchString -----> " + searchString);
query.setParameter ("searchString", searchString);
return query.getResultList();
} catch (RuntimeException re) {
log.error("findByCompetentBodyAndStatus failed", re);
throw re;
}
}
But I realized that the query does not do LIKE but equals
the spring I am looking for is "iOS/032/027"
, ok for "iOS/032/027"
, but not for "iOS/"
or "027"