Re: Recovering PK from a new Object

From: Mike Kienenberger (mkienen..laska.net)
Date: Wed Apr 28 2004 - 13:27:30 EDT

  • Next message: Eric Schneider: "Fw: Hibernate or Cayenne?"

    Jorge Sopena <jsopen..idsa.es> wrote:
    > public Long getId() {
    > return (getObjectId() != null && !getObjectId().isTemporary())
    > ?
    > (Long)getObjectId().getIdSnapshot().get(ID_PK_COLUMN)
    > : null;
    > }

    Can you use use "Number" instead of "Integer" or "Long"?
    Then you don't have to worry about the specific type of the primary key.

    Since it's unlikely you're going to try to modify it, the Number class
    already contains any read-only access you'd need to the data.



    This archive was generated by hypermail 2.0.0 : Wed Apr 28 2004 - 13:26:10 EDT