Thanks for the info. That has made one of my queries work, but the other one is a little more complex.
I have some code here:
DetachedCriteria crit = DetachedCriteria.forClass(FileDependency.class);
if (inFileName != null && inFileName.trim().length()!=0) {
inFileName = inFileName.replace('*','%');
crit.add(Restrictions.or(
crit.createCriteria("feedFile").add(Restrictions.ilike("fileName",inFileName)),
crit.createCriteria("dependsOnFile").add(Restrictions.ilike("fileName",inFileName))
)
);
Because I am using spring, I need to create a detached query and then call it via the hibernateTemplate.
How do I set an "or" condition using a detached query? Restrictions.or only works for arguments (Criteria, Criteria), but I have arguments (DetachedCriteria, DetachedCriteria) so the above code has an error.
Thanks.
|