1、参考博客
http://blog.csdn.net/OyangYujun/article/details/45938905
ORMLite完全解析(三)官方文档第三章、自定义查询构造器 Custom Query Builder
实现()括号查询功能。上面的三种调用方式会生成相同的sql语句。对于混合mixANDs和ORs的复杂查询而言,最后一种格式必须正确组装
,如下面这个查询:
Where<Account, String> where = queryBuilder.where();
where.or(
where.and(
where.eq(Account.NAME_FIELD_NAME, "foo"),
where.eq(Account.PASSWORD_FIELD_NAME, "_secret")
),
where.and(
where.eq(Account.NAME_FIELD_NAME, "bar"),
where.eq(Account.PASSWORD_FIELD_NAME, "qwerty")
)
);
这个语句会长生下面这样的sql语句:
SELECT * FROM account
WHERE ((name = 'foo' AND password = '_secret')
OR (name = 'bar' AND password = 'qwerty'))
2、官方文档
http://ormlite.com/javadoc/ormlite-core/doc-files/ormlite_3.html#Statement-Builder
3、http://blog.csdn.net/industriously/article/details/50790624
4、http://www.cnblogs.com/vanezkw/archive/2012/08/15/2640290.html