timestamp on datamart

Hi

I'm looking at putting a timestamp column on the aggragateddatavalue
and aggregatedindicatorvalue tables. This is necessary if we want to
pull a "diff" of the aggrgatedXXXvalue table to only reflect values
which might have changed since last time we looked. Because the
datamart export uses a batchhandler rather than going through
hibernate I'm guessing it makes sense to generate the timestamp
updates manually - ie in exportDataValues method of
DefaultDataElementDataMart rather than depending on any hibernate or
database magic. Or could (or should) this sort of behaviour be pushed
into the batchhandler itself? I'm really not sure. My first instinct
is to say that timestamping a row is something which should really be
a framework thing and I shouldn't be writing application code to do
it. OTOH, to mix a metaphor, cleverness killed the cat ... if
exportDataValues() is the only place data gets exported to datamart
then just making new Date() and shoving it in is probably the easiest.

Anybody have any thoughts on this?

Cheers
Bob

Not sure it is possible with hibernate to set a default value for a
database column (i.e. now()) , but if so, you could just let the
database handle this if a NULL (not a frikkin zero) is passed to the
LastUpdated column. Some subversive people like me dump values into
the datamart with SQL instead of Java.Of course, this is not the
typical use case, but...it might be a very easy and lazy solution.
Should work on most databases

Have a look here..

http://www.blogplanet.net/blog/2009/04/hibernate-and-auto-generated-timestamps.html

ยทยทยท

On 11/19/10, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

Hi

I'm looking at putting a timestamp column on the aggragateddatavalue
and aggregatedindicatorvalue tables. This is necessary if we want to
pull a "diff" of the aggrgatedXXXvalue table to only reflect values
which might have changed since last time we looked. Because the
datamart export uses a batchhandler rather than going through
hibernate I'm guessing it makes sense to generate the timestamp
updates manually - ie in exportDataValues method of
DefaultDataElementDataMart rather than depending on any hibernate or
database magic. Or could (or should) this sort of behaviour be pushed
into the batchhandler itself? I'm really not sure. My first instinct
is to say that timestamping a row is something which should really be
a framework thing and I shouldn't be writing application code to do
it. OTOH, to mix a metaphor, cleverness killed the cat ... if
exportDataValues() is the only place data gets exported to datamart
then just making new Date() and shoving it in is probably the easiest.

Anybody have any thoughts on this?

Cheers
Bob

_______________________________________________
Mailing list: DHIS 2 developers in Launchpad
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : DHIS 2 developers in Launchpad
More help : ListHelp - Launchpad Help

--
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+260968395190