Showing posts with label gorm. Show all posts
Showing posts with label gorm. Show all posts

Wednesday, August 31, 2016

Show error on grails domain class

When saving the a domain class and the data is not saved to the database, we can trace with this code :


if (!myDomainObj.save()) {
   log.warn myDomainObj.errors.allErrors.join(' \n') //each error is an instance of  org.springframework.validation.FieldError    
}

reference : http://stackoverflow.com/questions/4765037/why-doesnt-grails-notify-me-of-error-at-domain-object-saving

Tuesday, May 26, 2015

Grails / GORM database mapping Money data type on Microsoft SQL Server

import java.math.BigDecimal
class Cloth {
    ...
    BigDecimal price
    ...
    static mapping = {
        price sqlType: "money"
    }
}

reference : https://msdn.microsoft.com/en-us/library/ms378878(v=sql.110).aspx
remember, grails is java too :D