Grails startup after adding lazy false to domain class taking forever on IntelliJ IDEA -
i facing org.hibernate.lazyinitializationexception: not initialize proxy - no session issue in this answer. used second option, i.e. making association between domain classes non lazy (lazy:false)
but when try run app, waiting 15mins. application not start!!!
i using grails 2.2.1 on intellij idea 12.1.4.
here bit of code(poolservice.groovy):
def removechildfrompool(accounttofollow accounttofollow){ try { def pool=pool.first() if(!pool.isattached()){ pool.attach() } if(!accounttofollow.isattached()){ accounttofollow.attach() } pool.removefromaccounttofollow(accounttofollow) pool.save(flush:true) accounttofollow.delete(flush: true) return true } catch (exception e) { return false } } attach above not work , gives false. modified domain class below(just added static constraints lazy:false):
class pool { //can account id or name dependent on input csv format string poolname static hasmany = [accounttofollow:accounttofollow] static constraints = { poolname nullable: false,unique: true accounttofollow nullable: true } //added later on , changed caused grails not restart static mapping={ accounttofollow lazy: false } }
Comments
Post a Comment