groovy字符串格式

groovy字符串格式,groovy,Groovy,我正在尝试测试groovy/grails的SQL查询。在讨论为什么SQL插入不起作用时,我试图打印出该查询行。令人惊讶的是,这甚至不起作用,所以我正在研究groovy中的字符串格式。如果有人对此有线索,请告诉我 println """INSERT INTO iu (version, path, uuid, name, description, sourceversionfrom, sourceversionexto,

我正在尝试测试groovy/grails的SQL查询。在讨论为什么SQL插入不起作用时,我试图打印出该查询行。令人惊讶的是,这甚至不起作用,所以我正在研究groovy中的字符串格式。如果有人对此有线索,请告诉我

println  """INSERT INTO iu (version, path, uuid, name, description,
                            sourceversionfrom, sourceversionexto,
                            targetversionfrom, targetversionexto,
                            phase, directive, classname, methodname,
                            functionalarea_id, upgradepath_id, date_created,
                            last_updated, mark4delete, firstAvailable_id,
                            lastAvailable_id, uniqueid_id, elementcreateddate,
                            purpose, implementationdetails, userimpact)
              VALUES ( ${this.version}, ${this.path}, ${this.uuid}, ${this.name},
                       ${this.description}, ${this.sourceversionfrom},
                       ${this.sourceversionexto}, ${this.targetversionfrom},
                       ${this.targetversionexto}, ${this.phase}, ${this.directive},
                       ${this.classname}, ${this.methodname}, $functionalarea_id,
                       $upgradepath_id, NOW(), NOW(), 0, ${this.projID},
                       ${this.projID}, ${this.uniqueid_id},
                       ${this.getElementCreatedDate()}, ${this.purpose},
                       ${this.implementationDetails}, ${this.userImpact} )"""

程序在该行之后暂停并待机

您的查询字符串没有问题。程序可能挂起通过getter检索其中一个属性(
version
path
uuid
,等等),或者调用
getElementCreatedDate


要查看程序挂起时正在执行的操作,可以生成线程转储。当groovy在终端或控制台窗口中以交互方式运行时,发送退出信号或在Linux或OS X上键入ctrl-\或在Windows上键入ctrl break。查找
“main”
线程并向下扫描堆栈跟踪,直到找到您自己的代码。

您所说的“程序停止并待机”是什么意思?它崩溃了?它什么也没打印出来就挂了?顺便说一句:您发布的代码在我看来很好…函数${this.getElementCreatedDate()}是问题的根源。我已经隔离了这个问题,它产生了一个空指针,导致程序停止运行。。。