简体   繁体   中英

how to discard a nested object in Grails web flow

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM