hibernate - Removing proxy part of grails domain object? -


i want @ actual instance of domain object. is, need serialize object, , i'm trying use domain object on 2 sides of httpinvoker chain. there way fully-loaded domain object doesn't have grails wiring, can serialize it?

we grailshibernateutil.unwrapifproxy(obj). won't rid of grails injected methods , such - of hibernate/gorm proxy, should sufficient.

edit:

  1. sorry asking, did declare domain class implements serializable?
  2. it might add/inject class, in grails non-bug 6379.
  3. this piece of code (got here) worked me in grails console on small domain class:

.

import org.codehaus.groovy.grails.orm.hibernate.cfg.grailshibernateutil import com.somegroup.domain.*  def loc = somedomainclass.get(1) loc = grailshibernateutil.unwrapifproxy(loc)  bytearrayoutputstream bos = new bytearrayoutputstream() objectoutput out = new objectoutputstream(bos)  out.writeobject(loc) byte[] yourbytes = bos.tobytearray() 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -