mysql - Float value not being correctly persisted to database -
i have grails application in i'm parsing xml file , using parsed data create objects , persist them mysql database.
one of classes has float property:
class foo { // ... float myfloat static constraints = { myfloat(scale: 9) // trying specify 9 digits of precision, doesn't seem making difference } // ... } while parsing xml come attribute value of 6378137. want assign value myfloat:
class myservice{ // ... def xml = new xmlparser().parsetext(myxmlfile.gettext()) def foo = new foo( myfloat: xml.attribute("my_float")?.tofloat() ).save() // ... } at point in debugger can see value of myfloat 6378137.0. problem after transaction commits value stored in database 6378140.
why isn't myfloat being stored value assign it?
you'll have set precision , scale in gorm/hibernate..
look below link ...
Comments
Post a Comment