JPA : Nondurable Identity

JPA requires that all objects have an identity. DataNucleus provides a vendor extension that allows objects of a class to not have a unique identity in the datastore. This type of identity is typically for log files, history files etc where you aren't going to access the object by key, but instead by a different parameter. In the datastore the table will typically not have a primary key. To specify that a class is to use nondurable identity with DataNucleus you would add the following to the MetaData for the class.

<entity class="org.mydomain.MyClass">
    <nondurable-id/>
    ...
</entity>

or using annotations, for example

@Entity
@org.datanucleus.api.jpa.annotations.NonDurableId
public class MyClass
{
    ...
}

DataNucleus provides support for "nondurable" identity for some datastores only currently (RDBMS, Excel, ODF, MongoDB, HBase, Cassandra, Neo4j). What this means for something like RDBMS is that the table of the class will not have a primary-key.