[OJB-developers] Bug in OQLQueryImpl
Brought to you by:
thma
From: Matthew B. <ma...@so...> - 2002-05-01 05:35:59
|
During the criteria flattening, to create the bind iterator, all criteria, regardless of if they have actual bindable criteria or not, are added to the bind iterator. I spent some time trying to find a rather nasty bug where my criteria wasn't getting bound correctly and came up with this: private Vector flatten(Criteria crit, Vector acc) { Enumeration e = crit.getElements(); while (e.hasMoreElements()) { Object o = e.nextElement(); if (o instanceof Criteria) { Criteria pc = (Criteria) o; flatten(pc, acc); } else { // null criteria doesn't have a binding variable. if (!(o instanceof ojb.broker.query.NullCriteria)) { SelectionCriteria c = (SelectionCriteria) o; acc.add(c); } } } return acc; } null doesn't have a binding variable, so we skip it. Are there other criteria types that don't have a bind variable ($X). Thomas, could you commit this fix? I'm still getting my CVS access set up (and figuring out cvs :)) |