I'm having a problem updating a Grails Domain class simply, and I really need a health check. My domain class
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 }}
When I try to update the Containers "tare" property as follows, I get an error (below)
myFoundContainer = Container.findByBarcode(contents.get("barcode")) def myContainer = Container.get(myFoundContainer.id ) def myTare = contents.get("tare") try{ myContainer.lock() myContainer.tare = myTare myContainer.save(flush:true) } catch (org.springframework.dao.OptimisticLockingFailureException e) { println(e) }
Then I get the error:
No value for parameter 1 java.sql.SQLException
What do I assume relates to the container identifier in the constructor? But I did not think that it would matter during the update.
In the console, I also see the following message:
Sleep mode: select id from container, where id =? and version =? to update
One thought, is this related to any of the hasOne constraints
I am using a MySQL database if this helps. Thanks for any help.
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