So I added an @InitialValue which calls a method to create the initial map and this seems to have fixed it. After reading the enhancement source I found out something tricky about this.
SpecifiedPropertyWorker.addReinitializer gets called if you don't set an initial value and it basically does (for property 'foo'): in finishLoad(): foo$default = foo; in pageDetached(): foo = foo$default; now, in my class in finishLoad I was doing essentially: foo = new HashMap(); So on the first call to the page this would set the default value of the property to that specific object. So if you reset your session you would get the same object back when it initialized it to the default value. However, when you use @InitialValue the enhancement adds the following: finishLoad(): foo$initialValueBinding = foo$initialValueBinding.createBinding(this); foo = (evaluate the binding); pageDetached(): foo = (evaluate the binding); So it appears that if you are going to @Persist an object and need the initial value to not be null you should be sure to use @InitialValue or otherwise you could end up with some weirdness. In my case it works if you test it naively but fortunately my test cases were robust enough to catch it. On Thu, 2006-12-07 at 10:58 -0500, Dan Adams wrote: > I need a sanity check. :) So I have the following map of maps which I > need to persist in the user session: > > @Persist > public abstract Map<String, Map<String, Object>> getPageParameters(); > public abstract void setPageParameters(Map<String, Map<String, Object>> > params); > > Everything seems to work fine except that if I clear my session by > deleting my cookies and come back to the page getPageParameters() > returns the same map rather than null. I mean, it should return null > right? I'm running this in Jetty in case it matters. > -- Dan Adams Senior Software Engineer Interactive Factory 617.235.5857 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]