Re: Making sense of callbacks

From: Aristedes Maniatis (
Date: Thu Nov 29 2007 - 03:56:54 EST

  • Next message: Ari Maniatis (JIRA): "[JIRA] Commented: (CAY-923) AboutDialog problems"

    On 29/11/2007, at 12:28 PM, Aristedes Maniatis wrote:

    > Summary
    > -------
    > * prePersist() is only useful as a place to set object attributes
    > (such as creationDate) since you cannot follow relations reliably in
    > a ROP environment.
    > * postUpdate() and postPersist() are useful for changes which do not
    > need to be committed atomically with the original commit. So good
    > for creating log records, but not ideal for updating invoiceOwing.
    > * postPersist() is badly named. It is really postInsert()
    > * we need preInsert()

    With some further reading of the JPA specification I have come to the
    following conclusions:

    * the JPA was written by lawyers who get paid by the word

    * postPersist() is defined in the JPA to occur after a NEW record is
    written to the database. Which is how Cayenne works.

    * pre/postUpdate(): the JPA specification is very very unclear, but it
    looks like maybe it might apply for both new and existing records. But
    then postUpdate() overlaps postPersist() which is a bit pointless.

    * if preUpdate() is just for existing records we still need a

    So, even though we have to follow the poorly named callbacks in JPA,
    an extra callback would fill a useful hole.


    Level 1, 30 Wilson Street Newtown 2042 Australia
    phone +61 2 9550 5001 fax +61 2 9550 4001
    GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A

    This archive was generated by hypermail 2.0.0 : Thu Nov 29 2007 - 03:57:41 EST