I do not have a soultion to your problem but only a suggestion. To narrow down the problem a bit, you could run your Hibernate related code outside Tapestry (if you have not done so already) and see if the same problem occurs.
Shing. --- John Gordon <[EMAIL PROTECTED]> wrote: > Hi Folks, > > I'm running into an issue where I have a > disconnected User object embedded > in my app's Visit object that is not reflecting the > state of the database > after I modify it. Has anyone successfully managed > an object in the Visit > object with hibernate? > > My environment: > > Tapestry 3.0.2 > Spring framework > Hibernate 2.x > > Spring is managing transactions for Hibernate in a > class I wrote, a filter > flushes any sessions that exist when the http > request finishes. > > All seems to be working very well for me but in this > one situation: > > A user provides login credentials, the application > makes a hibernate call > and is returned a valid User object. The User object > is then put into the > site's Visit object. My idea is that I would then > access the User object > throughout my application via the Visit object (e.g. > ((MyVisit) > getVisit()).getUser() ). > > The User object has a Set of Project objects that is > maintained by > hibernate. The problem happens when I delete a > Project from this set (this > is done by iterating through the set and calling > interator.remove() when I > find the object to delete). Subsequent calls to the > User object are fine > given I _don't_ try and access the Set of Project > objects. As soon as I > access the Set, the object returns the Set, > including the Project object I > deleted! This happens the other way too: adding a > Project to the Set then > later accessing the Set does _not_ return my newly > added Project. > > Okay, this is all strange. Stranger still is that > the Hibernate correctly > deletes or inserts the Project to/from the database; > the tables show the > insertion or deletion. Another clue: when I kill the > Tapestry session and > re-login, the User object's Project Set contains the > correct Project > objects. > > I know there are a lot of frameworks going on here, > Tapestry; Hibernate; > Spring, but I wanted to check with this list first > before continuing to bang > my head against the wall. It seems to me that > either: > > The local Hibernate cache is getting jacked up for > some reason > or > I'm not handling disconnecting/reconnecting my User > object on subsequent > requestsl > > Thanks for any insights you can provide (code > example of using the Visit > object with Hibernate would be awesome!) > > John > > -- > "I have made this letter longer than usual, only > because I have not had the > time to make it shorter." -- Blaise Pascal > ------------------------------------------------------------------ > [EMAIL PROTECTED] > Home page : http://uk.geocities.com/matmsh/index.html Send instant messages to your online friends http://uk.messenger.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]