I guess in more complex apps the UI elements end up with lots of references to model objects so detaching does save a lot of memory and it also makes transferring session data from one web server to another (if required) in a multi server environment, much more efficient. I have experienced the result of accidentally serializing an object graph with megabytes of data that didn't use detach - ouch!
The other benefit of detaching is your model will expose updates to the UI (if a redisplay occurred) that were made in other ORM sessions (depending on your ORM). Keeping a non detached copy of the model object will typically be like caching it in it's current state for most ORMs - i.e. it can get stale >-----Original Message----- >From: tobi [mailto:[email protected]] >Sent: Thursday, 22 November 2012 9:10 PM >To: [email protected] >Subject: How important is detaching models really ? > >Hi guys, > > From my understanding & experiments with Wicket's built-in session >inspector , detaching models seems to just affect the size of the page >store (and of course cut-down the amount of I/O required for serializing >the object graph). The session size shown on my pages is a constantly >low value (<1k , we're storing nothing except the currently logged-in >user). > >So it *seems* not detaching models has no effect on the (long-term) >memory footprint of a Wicket application. > >According to >https://cwiki.apache.org/WICKET/working-with-wicket-models.html , not >detaching models should affect the session size but at least looking at >the inspector I can't see this. Is the wiki article still correct / the >inspector not telling the truth ? > >Thanks, >Tobias > >P.S. I'm using Wicket 1.5.8 btw > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [email protected] >For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
