← Back to team overview

dhis2-devs team mailing list archive

Re: timestamp on datamart

 

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@xxxxxxxxx> 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: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>


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



References