Concat where clauses in QueryBuilder

14 views
Skip to first unread message

in...@promo.de

unread,
Jun 8, 2017, 4:35:13 AM6/8/17
to ORMLite Users
Hello all,

I just started using ORMLite and the QueryBuilder.

Now I am wondering how to concatenate parts of the "where" clause, for example:

QueryBuilder<XXX, Integer> myQB = getResultQB();
// myQB now contains a valid "where" clause

// if I have got an additonal parameter in "myExtra" it should be "anded" to the existing where clause
if (!myExtra.isEmpty())) {
    myQB
.where()
   
.and()
   
.eq("fieldname", myExtra);
}


This leads to an exception:
java.lang.IllegalStateException: Expecting there to be a clause already defined for 'AND' operation

What am I doing wrong ...

Thanks a lot
Thilo Bretschneider
Promo GmbH
Reply all
Reply to author
Forward
0 new messages