2012-03-14 14 views
0

groovy/grailsのSQLクエリをテストしようとしています。なぜ、SQLインサートが機能していないのか、私はそのクエリーラインを印刷しようとしています。驚いたことに、その作業でもないので、私はgroovyの文字列フォーマットについて調査しています。誰かがそれについての手がかりを持っている場合は、私に知らせてください。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})""" 

プログラムが停止し、そのライン

+0

「プログラムは停止していますか?」とはどういう意味ですか?それはクラッシュする?何も印刷せずにハングアップしますか?ところであなたが投稿したコードは私にはうまく見えます... –

答えて

1

後に待機しているクエリ文字列と間違って何もありません。 getterを使用して、またはgetElementCreatedDateを呼び出して、プロパティ(versionpath、など)の1つを取得するときに、プログラムがハングしている可能性があります。

プログラムがハングアップしているのを確認するには、スレッドダンプを生成します。 groovyが端末またはコンソールウィンドウでインタラクティブに実行されているときは、QUITシグナルを送信するか、ctrl-¥をLinuxまたはOS Xに入力するか、ctrl-breakと入力してください。 "main"スレッドを探し、独自のコードに達するまでスタックトレースをスキャンします。

+0

関数$ {this.getElementCreatedDate()}は問題の原因です。私は問題を切り分けました。それはプログラムを静かにさせているNULLポインタを生成しています... – cybertextron

関連する問題