Re: "Can't get primary key from temporary id" :(

From: Mike Kienenberger (mkienen..mail.com)
Date: Wed Apr 22 2009 - 13:03:23 EDT

  • Next message: Adrian Wiesmann: "Examples of EntityResult and SQLResultSetMapping"

    Might be a long shot, but if you start a root transaction at the start
    of PrePersist and then commit it in PostPersist, maybe that will work.

    On Wed, Apr 22, 2009 at 12:57 PM, Joseph Schmidt
    <joseph_schmidt7..ahoo.com> wrote:
    >>  You might also take a look at the 3.0 lifecycles that Ari mentioned
    >> in the issue, but my guess is that JPA lifecycles won't do what is
    >> needed.
    >
    > I did. To be inside the same transaction for writing,  PrePersist would be
    > the logical choice
    > (from what I understood the docs). The very short documentation from here:
    > http://cayenne.apache.org/doc/lifecycle-callbacks.html
    > mentions that this happens "after ObjectId and ObjectContext are set"
    >
    > The problem is that at that moment tying to write(access the value of the
    > PK) I still get the same error message like the title of this post. It looks
    > like ObjectId does not have the PK at that moment yet :(.
    >
    >
    > thanks,
    > Joseph.
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Apr 22 2009 - 13:04:15 EDT