Hibernate version: 1.3.1
Name and version of the database you are using: Oracle 10i
Hello,
I have the next callbak DAO method:
Code:
public Vmenstrans[] findByCodnt(
final String startdate,
final String enddate,
final String codInt)
throws VmenstransDaoException {
Collection collection = (Collection) this.hibernateTemplate.execute(
new HibernateCallback() {
public Object doInHibernate(Session session){
Query query = session.createQuery(" from Vmenstrans " +
" where timestamp >= to_date(?, 'dd/mm/yy HH24:MI') " +
" and timestamp <= to_date(?, 'dd/mm/yy HH24:MI') " +
" and upper(codint) like ? " +
" order by msgid desc ");
query.setCacheable(true);
query.setString(0, startdate);
query.setString(1, enddate);
query.setString(2, codInt);
return query.list();
}
});
Vmenstrans ret[] = convertToDTO( (List) collection );
return ret;
}
The problem comes in the
like ? part of the sentence, when the placeholder replaces the variable I'm not getting the expected effect of having something like:
"like %cat%"
I have tried adding;
" and upper(codint) like %?% "
or
" and upper(codint) like \'%?%\' "
but it does not work.
How can I add the wildcard
% to my placeholder query.
Thank you!