玩! MorphiaPlugin在CRUD中抛出IllegalArgumentException

时间:2012-09-15 17:19:45

标签: playframework morphia

当我尝试通过传递这样的where子句来自定义CRUD的list()函数时:

where = "state in (Punjab,Jammu and Kashmir)";
List objects = type.findPage(page, search, searchFields, orderBy, order, where);

我收到如下的IllegalArgumentException:

IllegalArgumentException occured : invalid where clause: state in (Punjab,Jammu and Kashmir).

我相信这是MorphiaPlugin在有这个MorphiaPlugin线的“和”的地方分裂

String[] propValPairs = where.split("(and|&&)");

对此有何解决方法?如何在我的where子句中逃避“和”这个词? 我使用的是Play 1.2.5和morphia-1.2.9。

1 个答案:

答案 0 :(得分:0)

您应该在“in”表达式中将“and”替换为“,”:

state in (Punjab,Jammu and Kashmir) => state in (Punjab,Jammu, Kashmir)