0

I am using Grails web flow. I have two domain classes ProducutItem and Product. Product Item has a field called product of type Product.

I use productItem.product to reference the product. Since I am using web Flow and I dont want to make these class serializable i have to discard them after the use. But I am not able to figure out how to discard the nested product Object. I have tried productItem.disacrd() or productItem.product.discard() but they dont work

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
saurabh
  • 151
  • 2
  • 12

1 Answers1

0

Discarding an object will only disconnect them from the hibernate session. That will not make them Serializable.

If you wish to avoid serializing the product object, you can try this:

productItem.discard()
productItem.product=null
Luis Muñiz
  • 4,649
  • 1
  • 27
  • 43
  • Disconnecting the product object from hibernate session is exactly what I need so that there is no need to serialize product domain. Using productItem.product=null in not working.. – saurabh Apr 12 '12 at 12:24
  • Do you mean that the serialization mechanism does not serialize an object if it is not connected to a hibernate session? What about Command objects, or simple strings that you have in your web flow? Do you mean that these objects will not be serialized either? – Luis Muñiz Apr 12 '12 at 12:51