Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32350

Re: JPA and extra fields

From Eternal Hope <laughingspam99@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: JPA and extra fields
Date 2015-08-18 06:25 +0100
Organization A noiseless patient Spider
Message-ID <mqufi0$605$1@dont-email.me> (permalink)
References <87zj1v3vnq.fsf@Equus.decebal.nl> <55cd52c4$0$298$14726298@news.sunsite.dk> <87r3n2sact.fsf@Equus.decebal.nl> <mqsh70$s82$1@dont-email.me>

Show all headers | View raw


On 17/08/2015 12:40, Martin Gregorie wrote:
> On Mon, 17 Aug 2015 08:22:10 +0200, Cecil Westerhof wrote:
>
>> On Friday 14 Aug 2015 04:30 CEST, Arne Vajhøj wrote:

<snip>

>
> I agree about the value of adding columns to tables that are not used by
> the application and whose sole purpose is the keep track of when rows get
> updated and by which program. I've used them in the past and used
> triggers to maintain them independently from the application: by using
> triggers defined by the DBA and called below application level, a
> careless programmer can't forget to update them and their maintenance
> doesn't impact on application logic.

<humor>
Ah yes, of course, the infallable and omnipotent DBA cleverly using 
defensive programming to defend against the lazy and incompetent 
developer. It was ever thus. :-)
</humor>

 > and their maintenance
 > doesn't impact on application logic.

... but scatters that logic around the different layers of an 
application making it harder to get an overview and consequently 
impacting on the cost of maintenance.

The 'Object' view

A system of Things

Thing t                  //A Thing
ThingWorker tw           //A user/consumer of Things
ThingFactory tf          //C[reates] a Thing
ThingPersistance tp      //R[ead] U[pdate] D[estroy] a Thing
ThingServer ts           //initialize a Thing plus sql

t = tf.giveMeANewThing(tw)

ThingFactory.giveMeANewThing(ThingWorker tw){
     ThingServer ts
     Timestamp now

     Thing newThing = new Thing();  //it's a factory, it creates Things
     ts.initializeThing(newThing);

     newThing.setCreated(now);
     newThing.setUpdated(now);
     newThing.setCreator(tw.getIdentity());

     return newThing;
}

... //do lot's of stuff with your new Thing, takes time.

tw.doStuff(t);

... //later, possibly much later

tp.updateThing(t);

Surely the time and place to set created is when the Thing is created
also who created it.

Either you have a cohesive system of 'Objects' or you don't.

This is how I do it and I can change the persistance mechanism
however and whenever I want without regard to failities that may or may 
not be present in the underlying implementation of that mechanism.

Just interested that's all.


-- 
Laughing Spam Fritter

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-13 20:12 +0200
  Re: JPA and extra fields Eternal Hope <laughingspam99@gmail.com> - 2015-08-13 20:29 +0100
    Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-17 07:40 +0200
  Re: JPA and extra fields Arne Vajhøj <arne@vajhoej.dk> - 2015-08-13 22:30 -0400
    Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-17 08:22 +0200
      Re: JPA and extra fields Martin Gregorie <martin@address-in-sig.invalid> - 2015-08-17 11:40 +0000
        Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-17 14:36 +0200
          Re: JPA and extra fields Martin Gregorie <martin@address-in-sig.invalid> - 2015-08-17 18:08 +0000
            Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-17 21:24 +0200
              Re: JPA and extra fields Martin Gregorie <martin@address-in-sig.invalid> - 2015-08-17 22:47 +0000
                Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-19 11:32 +0200
          Re: JPA and extra fields Arne Vajhøj <arne@vajhoej.dk> - 2015-08-17 19:48 -0400
        Re: JPA and extra fields Eternal Hope <laughingspam99@gmail.com> - 2015-08-18 06:25 +0100
          Re: JPA and extra fields Martin Gregorie <martin@address-in-sig.invalid> - 2015-08-18 10:49 +0000
            Re: JPA and extra fields Eternal Hope <laughingspam99@gmail.com> - 2015-08-19 09:00 +0100
              Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-19 11:36 +0200
                Re: JPA and extra fields Martin Gregorie <martin@address-in-sig.invalid> - 2015-08-19 10:48 +0000
      Re: JPA and extra fields Arne Vajhøj <arne@vajhoej.dk> - 2015-08-17 19:46 -0400
        Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-19 11:28 +0200
    Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-19 11:53 +0200
      Re: JPA and extra fields Martin Gregorie <martin@address-in-sig.invalid> - 2015-08-19 10:51 +0000
        Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-19 13:14 +0200
          Re: JPA and extra fields Cecil Westerhof <Cecil@decebal.nl> - 2015-08-19 14:19 +0200
      Re: JPA and extra fields Arne Vajhøj <arne@vajhoej.dk> - 2015-08-19 19:13 -0400
  Re: JPA and extra fields Silvio <silvio@internet.com> - 2015-08-20 03:49 +0200

csiph-web