This may help: http://markmail.org/message/v3rjvfbvbbhncuod
Matt On 12/18/07, Rob Hills <[EMAIL PROTECTED]> wrote: > Hi Marcel, > > MarcelR wrote: > > I use: > > @Version > > private Timestamp changeDate; > > > > Standard in jpa (that I use most), don't know about hibernate.... > > > That works well, provided you don't want to use optimistic locking. > There are quite well-documented problems with using timestamps for > optimistic locking. Unfortunately, I need optimistic locking, otherwise > it'd be a very nice, easy solution. > > Rob Hills 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. > >> > Cheers, > Rob Hills > Waikiki, Western Australia > > --------------------------------------------------------------------- > 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]