-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: I want a modified timestamp that works!
PostPosted: Tue Oct 04, 2005 2:39 pm 
Beginner
Beginner

Joined: Mon Sep 27, 2004 4:28 pm
Posts: 44
I'm using 3.0.5

My entities have a modified timestamp on them. I've been setting it in an Interceptor in the methods onSave() and onFlushDirty(). Unfortunately, that fails me in one case... when a parent entity is updated, and only a collection has been modified, onFlushDirty() is never called.

I suppose what I want is for the entity passed to session.update() to have it's modified timestamp touched whenever the session.update() method will result in some SQL.

To cover the likely suggestions... I've tried implementing Lifecycle (which has the same problem). I've also tried using a <timestamp> property in my hbm.xml files. This actually solves my problem, but introduces another!

The problem it introduces for me is that hibernate will now version-check my changes for stale updates. I'd actually prefer a last-update-wins strategy, but I can't seem to figure out how to ask hibernate to maintain a version timestamp for me, but ignore the property when updating.

Has anyone tackled this?

Thanks in advance.
Phill


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 3:15 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Just use trigger for this stuff.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 11:52 am 
Beginner
Beginner

Joined: Mon Sep 27, 2004 4:28 pm
Posts: 44
I suppose I could accomplish this with a trigger, but I would need them on join tables, and child tables as well. They'd all have to update the parent entity. Anyways, it's not a bad suggestion and I guess it would work... but I'd rather keep this kind of logic out of my database.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.