ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jared Blitzstein <ja...@blitzstein.net>
Subject Question about Abator and Java5 example building, I can't add a second and clause
Date Sun, 10 Feb 2008 19:56:00 GMT
I have a case where I need to do some "if" logic before I know to add  
an and statement. I have a snippet like this:

Example example = new Example();

if (a==b) {
   example.createCriteria().andField1EqualTo(5);
}

if (c==f) {
   example.createCriteria().andField2EqualTo(5);
}

Doing this results in only one where clause,  "where Field1 = 5" and  
not like "where Field1 = 5 and Field2 = 5" like I want. Am I using the  
correct syntax or is there a different way to do this? Essentially I'm  
building the where clause based on user input. 
Mime
View raw message