I've stumbled on a problem with implementing a custom persistent field strategy that uses Hibernate. As the the application uses Hibernate I would like to use Hibernate entities as models, but this causes a problem when storing entities in the session as our Hibernate session is created per request and the HTTP session's stored values live longer than a request. Somewhere the entities need to be merged so they get re-attached to the new session.
Our solution has been to implement a custom persistent field strategy that merges an entity before returning the persistent value from the HTTP session. This approach worked just fine until we added two different pages that stored the same entity in the HTTP session. At some point the two different values are read from the HTTP session causing one of them to be overwritten even though they reside in different pages. What I don't understand is when the persistent values are read, that is when PersistentFieldStrategy.gatherFieldChanges is actually called. It seems that values are sometimes read even though a page is visited that lacks persistent fields or that PersistentFieldStrategy.gatherFieldChanges is called for a different page than the visited page. Has this something to do with the implementation of the gathering of persistent field information? Is perhaps the usage of a custom persistent field strategy the wrong approach? At the moment I'm a bit confused and would appreciate any help and or pin points I can get. /Olof --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
