Gorm找到或保存多个

时间:2014-12-11 22:42:50

标签: hibernate grails gorm

我在多重查找或保存中可能存在问题。

这是init进程

  

Typecard typecard = Typecard.findOrSaveByName(“personne”)

     

提案提案= Proposal.findOrSaveByName(“提案1”)

     

提案proposal1 = Proposal.findOrSaveByName(“命题2”)

第一个保存序列完美无缺!

  

卡片卡=新卡(类型:typecard,提案:[提案])

     

card.save()

然而,借调序列不起作用:(

  

Card.findOrSaveByTypecardAndProposals(typecard,[proposal1])

我的问题很简单:为什么?如果你有一个想法..

此错误日志

Error |
2014-12-11 23:37:41,586 [localhost-startStop-1] ERROR spi.SqlExceptionHelper  - Parameter "#3" is not set; SQL statement:
select this_.id as id1_0_0_, this_.version as version2_0_0_, this_.typecard_id as typecard3_0_0_ from card this_ where this_.typecard_id=? and this_.id=? limit ? [90012-176]

Error |
2014-12-11 23:37:41,600 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Hibernate operation: could not extract ResultSet; uncategorized SQLException for SQL [n/a]; SQL state [90012]; error code [90012]; Parameter "#3" is not set; SQL statement:
select this_.id as id1_0_0_, this_.version as version2_0_0_, this_.typecard_id as typecard3_0_0_ from card this_ where this_.typecard_id=? and this_.id=? limit ? [90012-176]; nested exception is org.h2.jdbc.JdbcSQLException: Parameter "#3" is not set; SQL statement:
select this_.id as id1_0_0_, this_.version as version2_0_0_, this_.typecard_id as typecard3_0_0_ from card this_ where this_.typecard_id=? and this_.id=? limit ? [90012-176]
Message: Hibernate operation: could not extract ResultSet; uncategorized SQLException for SQL [n/a]; SQL state [90012]; error code [90012]; Parameter "#3" is not set; SQL statement:
select this_.id as id1_0_0_, this_.version as version2_0_0_, this_.typecard_id as typecard3_0_0_ from card this_ where this_.typecard_id=? and this_.id=? limit ? [90012-176]; nested exception is org.h2.jdbc.JdbcSQLException: Parameter "#3" is not set; SQL statement:
select this_.id as id1_0_0_, this_.version as version2_0_0_, this_.typecard_id as typecard3_0_0_ from card this_ where this_.typecard_id=? and this_.id=? limit ? [90012-176]

我创建了gist以查看登录完整性https://gist.github.com/sovlin/af7f8746d3bc3e752d13

我创建了简单的应用,例如https://github.com/sovlin/bugGORM

0 个答案:

没有答案