Fixed it. I'm dumb. A copy-paste problem caused me to be using the wrong class when I called getCurrentSession().createCriteria(). It's still odd that Hibernate decided to give me 1=1, but maybe it makes sense in some weird way.
I'm using Hibernate 3.2.4.sp1, and when I try to add an Example object to my Disjunction, it results in a (1=1) in my where clause. My code is basically this:
Code:
Junction disjunction = Restrictions.disjunction();
for (int i = 0; i < certs.length; i++) {
disjunction.add(Example.create(certs[i]));
}
List results = criteria.add(disjunction).list();
In my current test, my certs array has 3 elements, and when I execute it Hibernate generates the following where clause:
Code:
where ((1=1) or (1=1) or (1=1))
It works fine if I populate my disjunction with an individual field instead:
Code:
disjunction.add(Expression.eq(FIELD_CERTIFICATE_NUMBER, certs[i].getCertificateNumber()));
I dug through forums, documentation, and the debug logs, but haven't been enlighted yet as to why it's behaving this way. So (1) should I be able to add an Example object to a disjunction and if so (2) how do I fix it?
Thanks for the help,