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.  [ 1 post ] 
Author Message
 Post subject: Using audit columns as versioning
PostPosted: Fri Jul 07, 2006 1:53 pm 
Regular
Regular

Joined: Wed Feb 15, 2006 9:09 pm
Posts: 76
Hello,

In each of my tables, I have the following:

Code:
CREATE TABLE my_table (
  -- ...
  create_user_name VARCHAR2(30) NOT NULL,
  create_time DATE NOT NULL,
  modify_user_name VARCHAR2(30),
  modify_time DATE
);


I thought of using these columns for versioning (create_time and modify_time), HOWEVER:

* When a record is inserted, create_time is populated, modify_time is not (so it's NULL).
* From this point forward, create_time never changes.
* When this record is updated, modify_time changes.

Having said that, is it possible to use these columns for versioning? I read somewhere that the design implies that you can't use "insert" for generated, VERSION columns, which, while it makes sense, might not work.

The only thing I have going for me right now is that if modify_time is NULL, the record has never been updated.

Can I somehow make my own version class to handle this mix of two columns, or is there insufficient abstraction for this in the API? Do I have an alternative that doesn't affect the database design and treatment of the columns mentioned above?

EDIT: What about adding a NUMBER column to every table? Would this be most effective, or can I stick with what I have?

Thanks!


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

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.