Hi Ron,

On 13 Dec 2007 at 19:27, Ron Anderson wrote:

> this seems like it might be a good application for Spring AOP/AspectJ.  We've 
> used it in a project for logging what was changed and by whom with date/time.

I agree it looks a likely candidate.  Unfortunately, so far I've not been able 
to 
find any specific examples of implementing that kind of auditing.  I started 
reading some stuff on AOP in general, but unfortunately I don't have the 
time right now to come to terms with the gory details another component, 
though obviously a detailed knowledge of Spring would help me to better 
understand what Appfuse does "under the bonnet".

You wouldn't happen to have a URL for anything that provides a good 
description of how to specifically implement this kind of auditing 
functionality 
with Spring AOP, would you?  If not, don't worry, I'll just manage the politics 
and do it with triggers.

> ----- Original Message ----
> From: Rob Hills <[EMAIL PROTECTED]>
> To: users@appfuse.dev.java.net
> Sent: Thursday, December 13, 2007 4:54:38 PM
> Subject: Re: [appfuse-user] Automatic timestamping of all persisted data
> 
> Matt Raible wrote:
> > Have you thought about doing this with a trigger in your database? Do
> > you need to record the user's information along with this auditing?
> > I've done this with Event Listeners in the past.
> >   
> I'd be quite comfortable with doing it as a trigger, but  for 
> "political" reasons that could be a bit tricky (though not impossible).
>   
> I just thought that because it's such a common pattern, Hibernate would
> have a solution for it, but I guess it doesn't.
> 
> I've not played with event listeners yet, in general terms what event 
> would you hang one onto to do this kind of thing.  WRT recording users 
> information, there's nothing in the spec about that, but from what I 
> know of the client, I can see that requirement arising sooner or later.
> > On 12/13/07, Rob Hills <[EMAIL PROTECTED]> wrote:
> >>
> >> I'm using AppFuse 2.0 + Struts2 + Hibernate.
> >>
> >> I need to timestamp all of my persisted data.
> >>
> >> I have a base model class that includes a "lastUpdated" attribute
>  and I
> >> was hoping to be able to annotate it with something that would tell
> >> Hibernate to timestamp it whenever it was saved to the DB, much as
>  you
> >> would do with an "After Update" trigger.
> >>
> >> I've been hunting through the Hibernate documentation to see if it
>  has
> >> any "automatic" way of doing this, but haven't turned up anything
> >> obvious.  Hibernate has an @Temporal annotation, but AFAICT, it
>  simply
> >> provides a direction about the persisted datatype.
> >>
> >> Is there any way to "automate" this or will I have to do it myself
>  in
> >> the DAO?  If I have to do it myself in the DAO, I assume the most
> >> efficient way will be to have a base DAO class that sits between
> >> GenericDao and my own Dao's and have it do the timestamping
> ---------------------------------------------------------------------

TIA,
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]

Reply via email to