如何修复错误消息。 “请记住,序数参数是基于1的!”

时间:2010-12-07 15:16:45

标签: nhibernate grails hql gorm

给出代码片段(请不要问我为什么用这种方式构建它...)

...some more Logic...
def blaParam = ['checkinable':checkinable]
def blaQuery = " AND c.product = :checkinable"
...some more Logic...

def paramBox = [] + blaParam
def queryBox = "" + blaQuery
def c = Bla.executeQuery("FROM Bla b WHERE 1 = 1 "+queryBox+" ", paramBox, [max:params.max])

我最后收到了一条消息

errors.GrailsExceptionResolver Remember that ordinal parameters are 1-based!

如何防止这种情况?

2 个答案:

答案 0 :(得分:1)

合并最后两个参数贴图对我有用:

Bla.executeQuery("FROM Bla b WHERE 1 = 1 "+queryBox+" ", paramBox + [max:params.max])

答案 1 :(得分:1)

如果我改变

def paramBox = [] + blaParam

def paramBox = [:] + blaParam

它正在运作