Rename Application StringIdentity


I don't think JDO supports altering an entity's Application Identity.  Does ObjectDB?

@PersistenceCapable public class MyClass implements Serializable, Cloneable{
    @Id private StringIdentity id;


PersistenceManager persistenceManager = ...;
Transaction transaction = persistenceManager.currentTransaction();
    MyClass myPersistedClass = persistenceManager.getObjectById(MyClass.class, new StringIdentity("UniqueExisting")); = new StringIdentity("UniqueNew");
    if(transaction.isActive()) transaction.rollback();

Would the above code keep my persisted object in the ObjectDB datastore and just change its "id" attribute?  (And update indexes and references appropriately?)  Or, does ObjectDB reject the attempt with an Exception?



ObjectDB doesn't support changing the primary key (id) of objects, since that may affect references from other objects and indexes.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login