Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate 更新Grails域类时出现问题_Hibernate_Grails_Gorm_Grails Domain Class - Fatal编程技术网

Hibernate 更新Grails域类时出现问题

Hibernate 更新Grails域类时出现问题,hibernate,grails,gorm,grails-domain-class,Hibernate,Grails,Gorm,Grails Domain Class,我对Grails域类的简单更新有一个问题,我真的需要一个健全性检查。我的域类是 class Container implements Serializable{ String barcode Float tare static hasOne = [containerContent:ContainerContent, containerSolvent:ContainerSolvent] static constraints = { barcode blank: false, nulla

我对Grails域类的简单更新有一个问题,我真的需要一个健全性检查。我的域类是

class Container implements Serializable{

String barcode
Float tare
static hasOne = [containerContent:ContainerContent, containerSolvent:ContainerSolvent]

static constraints = {
    barcode blank: false, nullable: false, unique: true, size: 0..100
    containerSolvent blank: true, nullable: true, unique: true
    containerContent blank: true, nullable: true, unique: true
    tare blank: true, nullable: true
}}
当我试图用以下方式更新Containers属性“tare”时,我得到了一个错误(如下所示)

然后我得到一个错误:

没有为参数1指定值java.sql.SQLException

我假设它引用了构造函数中的容器id?但我认为这在更新期间并不重要

在控制台中,我还看到以下消息:

Hibernate:从id=?和版本=?用于更新

有一种想法,这是否与任何约束“hasOne”有关

如果有帮助的话,我正在使用MySQL数据库。谢谢你的帮助

  No value specified for parameter 1. Stacktrace follows:
Message: No value specified for parameter 1
    Line | Method
->> 1074 | createSQLException    in com.mysql.jdbc.SQLError
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    988 | createSQLException    in     ''
|    974 | createSQLException .  in     ''
|    919 | createSQLException    in     ''
|   2611 | checkAllParametersSet in com.mysql.jdbc.PreparedStatement
|   2586 | fillSendPacket        in     ''
|   2510 | fillSendPacket . . .  in     ''
|   2259 | executeQuery          in     ''
|     96 | executeQuery . . . .  in org.apache.commons.dbcp.DelegatingPreparedStatement
|    358 | uploadMethod          in com.sagerx.UpdateContainerStatusUponReceiptService$$EOHFXFJX
|     24 | uploadFile . . . . .  in com.sagerx.UpdateContainerStatusController
|    195 | doFilter              in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . . .  in grails.plugin.cache.web.filter.AbstractFilter
|   1110 | runWorker             in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run                   in java.lang.Thread

这可能与此有关(本文中也提到)


本期文章提到了在一对一关联上使用
unique:true
约束时发生的类似错误。尝试从
containerSolvent
containerContent

myTare
myFoundContainer
添加到问题中。我将这些值(皮重和条形码)从电子表格导入到地图中,我可以确认它们不是空的。您已经拥有了容器,你为什么再做一次
get
myFoundContainer
myContainer
不一样吗?是的,我补充说,当我认为“findByBarcode”完整堆栈跟踪可能会有一些有趣的事情发生时,现在会很有帮助。谢谢,现在尝试一下……我想知道这是否是问题的一部分。如果我有更多的代表,我会给你一个分数!!万分感谢,这真是令人沮丧,听到它有帮助真是太好了。您可能应该投票支持这个Grails Jira问题
  No value specified for parameter 1. Stacktrace follows:
Message: No value specified for parameter 1
    Line | Method
->> 1074 | createSQLException    in com.mysql.jdbc.SQLError
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    988 | createSQLException    in     ''
|    974 | createSQLException .  in     ''
|    919 | createSQLException    in     ''
|   2611 | checkAllParametersSet in com.mysql.jdbc.PreparedStatement
|   2586 | fillSendPacket        in     ''
|   2510 | fillSendPacket . . .  in     ''
|   2259 | executeQuery          in     ''
|     96 | executeQuery . . . .  in org.apache.commons.dbcp.DelegatingPreparedStatement
|    358 | uploadMethod          in com.sagerx.UpdateContainerStatusUponReceiptService$$EOHFXFJX
|     24 | uploadFile . . . . .  in com.sagerx.UpdateContainerStatusController
|    195 | doFilter              in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . . .  in grails.plugin.cache.web.filter.AbstractFilter
|   1110 | runWorker             in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run                   in java.lang.Thread