org.apache.cayenne

## Interface ObjectId

- All Superinterfaces:
    Serializable

      public interface ObjectId
      extends Serializable

  A portable global identifier for persistent objects. ObjectId can be temporary (used for transient or new uncommitted objects) or permanent (used for objects that have been already stored in DB).

  A temporary ObjectId stores object entity name and a pseudo-unique binary key; permanent id stores a map of values from an external persistent store (aka "primary key").

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `ObjectId` | `createReplacementId()`
    `String` | `getEntityName()`
    `Map<String,Object>` | `getIdSnapshot()`
    `byte[]` | `getKey()`
    `Map<String,Object>` | `getReplacementIdMap()`
    `boolean` | `isReplacementIdAttached()`
    `boolean` | `isTemporary()`
    `static ObjectId` | `of(String entityName)` Creates a temporary ObjectId for a given entity.
    `static ObjectId` | `of(String entityName, byte[] tmpKey)` Creates a temporary ObjectId for a given entity, using provided unique id key.
    `static ObjectId` | `of(String entityName, Map<String,?> values)` Creates an ObjectId, potentially mapped to multiple columns.
    `static ObjectId` | `of(String entityName, ObjectId objectId)` Creates an ObjectId using another id as a template, but for a different entity.
    `static ObjectId` | `of(String entityName, String keyName, Object value)` Creates a single key/value permanent ObjectId.

- - ### Method Detail

    - #### of

          static ObjectId of(String entityName)

      Creates a temporary ObjectId for a given entity.
      Since:
        4.2

    - #### of

          static ObjectId of(String entityName,
                             byte[] tmpKey)

      Creates a temporary ObjectId for a given entity, using provided unique id key.
      Since:
        4.2

    - #### of

          static ObjectId of(String entityName,
                             String keyName,
                             Object value)

      Creates a single key/value permanent ObjectId.
      Since:
        4.2

    - #### of

          static ObjectId of(String entityName,
                             ObjectId objectId)

      Creates an ObjectId using another id as a template, but for a different entity. Useful inside the Cayenne stack when resolving inheritance hierarchies.
      Since:
        4.2

    - #### of

          static ObjectId of(String entityName,
                             Map<String,?> values)

      Creates an ObjectId, potentially mapped to multiple columns.
      Since:
        4.2

    - #### isTemporary

          boolean isTemporary()

    - #### getEntityName

          String getEntityName()

    - #### getKey

          byte[] getKey()

    - #### getIdSnapshot

          Map<String,Object> getIdSnapshot()

    - #### getReplacementIdMap

          Map<String,Object> getReplacementIdMap()

    - #### createReplacementId

          ObjectId createReplacementId()

    - #### isReplacementIdAttached

          boolean isReplacementIdAttached()

Copyright © 2001–2021 Apache Cayenne. All rights reserved.