Overriding datanucleus automatically generated id field
According to:
http://www.datanucleus.org/products/accessplatform_3_0/jdo/datastore_identity.html
If an persistable object doesn't have an id field, datanucleus will automatically generate an id field for. Oh and I hate that !
@DatastoreIdentity(column = "id", strategy = IdGeneratorStrategy.IDENTITY) //Nice, good looking auto-increment id field
But what if that's not the whole view of the case ? I faced this situation when I had my object persisted within the graph of another objects. This case is datanucleus calls it, the compound identity.
http://www.datanucleus.org/products/accessplatform_3_0/jdo/orm/compound_identity.html
http://www.datanucleus.org/products/accessplatform_3_0/jdo/datastore_identity.html
If an persistable object doesn't have an id field, datanucleus will automatically generate an id field for. Oh and I hate that !
@DatastoreIdentity(column = "id", strategy = IdGeneratorStrategy.IDENTITY) //Nice, good looking auto-increment id field
But what if that's not the whole view of the case ? I faced this situation when I had my object persisted within the graph of another objects. This case is datanucleus calls it, the compound identity.
http://www.datanucleus.org/products/accessplatform_3_0/jdo/orm/compound_identity.html
Comments
Post a Comment