groovy - Grails/GORM BigInteger Unsigned Rejected -
i'm getting following error:
| error 2014-08-18 11:25:00,324 [localhost-startstop-1] error context.grailscontextloaderlistener - error initializing application: validation error(s) occurred during save(): - field error in object 'my.package.content' on field 'filenamelookup': rejected value [16731516642733300018]; codes [my.package.content.filenamelookup.typemismatch.error,my.package.content.filenamelookup.typemismatch,content.filenamelookup.typemismatch.error,content.filenamelookup.typemismatch,typemismatch.my.package.content.filenamelookup,typemismatch.filenamelookup,typemismatch.java.lang.long,typemismatch]; arguments [filenamelookup]; default message [could not convert number [16731516642733300018] of type [java.math.biginteger] target class [java.lang.long]: overflow] message: validation error(s) occurred during save(): - field error in object 'my.package.content' on field 'filenamelookup': rejected value [16731516642733300018]; codes [my.package.content.filenamelookup.typemismatch.error,my.package.content.filenamelookup.typemismatch,content.filenamelookup.typemismatch.error,content.filenamelookup.typemismatch,typemismatch.my.package.content.filenamelookup,typemismatch.filenamelookup,typemismatch.java.lang.long,typemismatch]; arguments [filenamelookup]; default message [could not convert number [16731516642733300018] of type [java.math.biginteger] target class [java.lang.long]: overflow] line | method ->> 6 | docall in bootstrap$_closure1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 327 | evaluateenvironmentspecificblock in grails.util.environment | 320 | executeforenvironment . . . . . in '' | 296 | executeforcurrentenvironment in '' | 266 | run . . . . . . . . . . . . . . in java.util.concurrent.futuretask | 1142 | runworker in java.util.concurrent.threadpoolexecutor | 617 | run . . . . . . . . . . . . . . in java.util.concurrent.threadpoolexecutor$worker ^ 745 | run in java.lang.thread error | forked grails vm exited error
domain class:
package my.package // need fix constraints class content { // int id long filenamelookup static mapping = { version false filenamelookup column: 'file_name_lookup', type:org.hibernate.type.longtype, class: long } static constraints = { filenamelookup(nullable:true, display:false, editable: false) } }
bootstrap.groovy:
import my.package.content class bootstrap { def init = { servletcontext -> new content(filenamelookup:16731516642733300018).save(failonerror:true) } def destroy = { } }
i tried long, biginteger, integer, etc... , burnt hours on trying figure out how bigint(20) unsigned save test db. how tell grails/gorm number bigint(20) can handle regardless of database i'm using?
long.max_value 9,223,372,036,854,775,807. number big it. using bigdecimal should fix this.
bigdecimal filenamelookup
Comments
Post a Comment