Eric Dobbs wrote:
> On Monday, April 29, 2002, at 08:08 PM, Sam Joseph wrote:
>
>> + * @author <a href="mailto:[EMAIL PROTECTED]">Sam Joseph</a>
>
> done.
Thanks
>> > In the test you sent
>> > I didn't see the test that confirms the conversion.
>
>
> dang buggy fingers! I meant "confirms the recursion".
> I thought you had mentioned a test of that sort in an
> earlier email. If I was imagining things then
> nevermind. 8^)
Oh right, uh, yeah, I was using that parsing operation to create a
complete copy of the nested criterion, and then running equals on the
two, as well as comparing the actual strings. The Criterion.Equals()
function recurses right? And then I was getting all tables and
comparing them with the individual tables of the individual criterion.
Anyway, you can check the recursion by creating two identical nested
criterion and then seeing if they equal, and seeing if two different
criterion are not confirmed as equal:
Criteria.Criterion x_crit2 = c.getNewCriterion(table2, column2,
(Object)value2, Criteria.EQUAL);
Criteria.Criterion x_crit3 = c.getNewCriterion(table3, column3,
(Object)value3, Criteria.EQUAL);
Criteria.Criterion x_crit4 = c.getNewCriterion(table4, column4,
(Object)value4, Criteria.EQUAL);
Criteria.Criterion x_crit5 = c.getNewCriterion(table5, column5,
(Object)value5, Criteria.EQUAL);
x_crit2.and(x_crit3).or(x_crit4.and(x_crit5));
Criteria.Criterion x_crit6 = c.getNewCriterion(table2, column2,
(Object)value2, Criteria.EQUAL);
Criteria.Criterion x_crit7 = c.getNewCriterion(table3, column3,
(Object)value3, Criteria.EQUAL);
Criteria.Criterion x_crit8 = c.getNewCriterion(table4, column4,
(Object)value4, Criteria.EQUAL);
Criteria.Criterion x_crit9 = c.getNewCriterion(table5, column5,
(Object)value5, Criteria.EQUAL);
x_crit6.and(x_crit7).or(x_crit8.and(x_crit9));
assert(x_crit2.equals(x_crit6));
Criteria.Criterion x_crit10 = c.getNewCriterion(table2, column2,
(Object)value2, Criteria.EQUAL);
Criteria.Criterion x_crit11 = c.getNewCriterion(table3, column3,
(Object)value3, Criteria.EQUAL);
Criteria.Criterion x_crit12 = c.getNewCriterion(table4, column4,
(Object)value4, Criteria.EQUAL);
Criteria.Criterion x_crit13 = c.getNewCriterion(table5, column5,
(Object)value5, Criteria.EQUAL);
x_crit10.and(x_crit11.or(x_crit12)).and(x_crit13);
try{
assert(x_crit2.equals(x_crit10));
fail("didn't fail on comparing different criterion");
}catch(Exception e)
hmm - a function that allowed you to clear all the nested criterion
would be really useful for testing.
Anyways, I think that should do it. The tests for the grabbing all the
tables and criterion should be in the file I already sent you.
CHEERS> SAM
p.s. while I have your attention, do you know if torque has any
mechanism to support limits on results when the database doesn't or is
complicated to implement like MSSQL? I mean like using the jdbc to
limit which results come back? Not to worry if you don't - I'll mail
the list as well ....
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>