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


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

Re: JPA and extra fields

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.java.programmer
Subject Re: JPA and extra fields
Date Wed, 19 Aug 2015 14:19:59 +0200
Organization Decebal Computing
Lines 36
Message-ID <871tezqxlc.fsf@Equus.decebal.nl> (permalink)
References <87zj1v3vnq.fsf@Equus.decebal.nl> <55cd52c4$0$298$14726298@news.sunsite.dk> <87mvxnr4e8.fsf@Equus.decebal.nl> <mr1n3r$c4n$2@dont-email.me> <87614br0n7.fsf@Equus.decebal.nl>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="5641"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vEhkwZ0J3Lf2L9qhmM26cqSvjWyEyEO0="
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
X-Homepage http://www.decebal.nl/
Cancel-Lock sha1:Xmd2lH9KI8EJjaRuxFXJoBxXKtE= sha1:KpsV8Fl85QrEYljF/q1bZM6v9uU=
Xref csiph.com comp.lang.java.programmer:32364

Show key headers only | View raw


On Wednesday 19 Aug 2015 13:14 CEST, Cecil Westerhof wrote:

> On Wednesday 19 Aug 2015 12:51 CEST, Martin Gregorie wrote:
>
>> On Wed, 19 Aug 2015 11:53:03 +0200, Cecil Westerhof wrote:
>>
>>> Another possibility would be to write the functions beforeCreate
>>> and beforeMutate. That would be probably better as my current
>>> solution?
>>>
>> On the assumption that I've understood the use of these data items,
>> this would be my preferred solution.
>
> I am going to remove the setter function and implement beforeCreate
> and beforeMutate. :-)

It became:
    public void beforeCreate() {
        setMutateInfo();
        dateCreated    = new Date();
        userIDCreation = SecurityUtil.getCurrentUser();
    }

    public void beforeUpdate() {
        setMutateInfo();
        timeMutated    = new Timestamp(new Date().getTime());
        userIDMutation = SecurityUtil.getCurrentUser();
    }

setMutateInfo does things that are needed for beforeCreate and
bedoreUpdate. It is of-course private void.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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