Thanks Thomas. Actually, right after I posted, the problem seems to have gone away. In my webapp, I am actually being careful not to maintain copies of the domain objects, as this would lead to precisely the issue you describe.
Michael ----- Original Message ----- From: "Thomas Mahler" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Sunday, November 30, 2003 11:42 PM Subject: Re: does PersistenceBroker.getCollectionByQuery use the cache? > Hi Michael, > > OJB puts all loaded entities (also those in collection attributes) into > the cache. > So if you can make sure that the updates are executed on exactly the > same instances (and not a copy) of the photos stored in your collection > everything should be fine. > > But this is exactly the problem! in webapplications you typically have a > some kind of (copying) data transfer between the jsp pages and the > domain model. If you are using copies somewhere, your changes to those > copies will be stored by the broker, but they are reflected in the cache. > > Please call broker.clearCache() before loading the complete album in > albumPhotos.jsp. If I am right it should now display all photos with the > correct information. > > cheers, > Thomas > > Michael Mogley wrote: > > In my webapp, I've run across what may be a bug in Ojb. > > > > I have an Album class with a collection of Photos. > > > > I also have a jsp page, photoEdit.jsp, that retrieves a specific > > Photo by identity, modifies it, then does PersistenceBroker.store. > > > > I have another page, albumPhotos.jsp, that lists all the photos in a > > given album along with some of their attributes. > > > > When I make a change in photoEdit.jsp to a given Photo, then go to > > albumPhotos.jsp to to list all the photos in the album, the Photo I > > changed is listed with the old attributes. > > > > I am using ObjectDefaultCacheImpl and the app initializes and keeps a > > reference to a single PersistenceBroker instance. > > > > It seems to me that when the Albums.photos collection attribute is > > being initialized, the elements in the collection are not being > > cached. > > > > Is this true? If so, it seems this would be bug. > > > > Or could I doing something half-assed? > > > > Thanks in advance. > > > > Michael > > > > > > > > > --------------------------------------------------------------------- > 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]
