I want to get a domain entity in grails in detached state when there is another domain entity for same id in same method.
I followed this How do you disconnect an object from it's hibernate session in grails? as a way to get a detached domain entity in grails.
def id = 23L;
def userInstance = User.get(id)
def oldInstance = User.get(id).discard()
userInstance.properties = params
userInstace.save(flush:true)
// Now, I want to compare properties of oldInstance and userInstance
// But I get null for oldInstance
So, how can I get a domain entity in grails in details such that it is detached from gorm session?