Sorry for the delay in response, I was out of town and didn't check my email 
much.  

You could compare the objects before saving to see if you should really invoke 
the save, but I suppose you wouldn't be any better off than your original 
suggestion.  I mean you'd still have to fetch the current state of the object 
from the database.  

You are right that our solution does not filter these "invalid" saves.  But it 
just occurred to me that it could be useful information.  Most often when we 
are looking at the archive it is to determine when and by whom a record was 
"messed up".  To know that someone viewed and saved the record after the 
problem entry would also be useful so you know who is not cleaning up messes 
they come across.

Nathan


----- "Rob Hills" <[EMAIL PROTECTED]> wrote:
> Hi Nathan,
> 
> On 27 Nov 2007 at 11:23, Nathan Anderson wrote:
> 
> > I've done archiving another way that worked pretty well.  Basically
> at the time you save the object you also create a new archive entry. 
> Seems a bit simpler than the approach you described.
> 
> Yes, that seems a good lateral solution to the problem.  The downside
> 
> (having one more archive record than you really need) is not too bad. 
> My 
> only problem with that approach is that I'm hoping also to add a bit
> of 
> selectivity to the archive process, for example not storing an archive
> record 
> when nothing has changed compared with the previous version.  This
> would 
> help prevent the archives filling up with redundant records from users
> who 
> click "save" instead of "close" or "cancel" after they've taken a look
> at a 
> record.
> 
> > ----- "Rob Hills" <[EMAIL PROTECTED]> wrote:
> 
> > > Using AppFuse 2.0 + Struts 2 + Hibernate
> > > 
> > > I need to maintain archived versions of some of my entities.  The
> > > pattern I'd 
> > > like to implement involves saving a copy of the old version of an
> > > entity (to 
> > > another table) just prior to persisting any updates to the
> entity.
> > > 
> > > In the save(xx) method of my manager, before saving, I do a
> "get()"
> > > with the 
> > > object's ID into a separate entity object with the idea that this
> > > would give me 
> > > the old version from the database.  However, it's actually
> returning
> > > the 
> > > updated "dirty" version of the entity.  I guess this makes sense,
> > > because I'm 
> > > using the same manager.
> > > 
> > > My question is, how do I go about getting the old version of the
> > > entity at this 
> > > point?
> 
> Cheers,
> Rob Hills
> Waikiki, Western Australia
> Mobile +61 (412) 904-357
> Fax: +61 (8) 9529-2137
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to