use of org.qi4j.spi.entitystore.EntityAlreadyExistsException in project qi4j-sdk by Qi4j.
the class EntityModel method newEntityState.
public EntityState newEntityState(EntityStoreUnitOfWork store, EntityReference identity) throws ConstraintViolationException, EntityStoreException {
try {
// New EntityState
EntityState entityState = store.newEntityState(identity, this);
// Set identity property
PropertyDescriptor persistentPropertyDescriptor = state().propertyModelFor(IDENTITY_METHOD);
entityState.setPropertyValue(persistentPropertyDescriptor.qualifiedName(), identity.identity());
return entityState;
} catch (EntityAlreadyExistsException e) {
throw new EntityCompositeAlreadyExistsException(identity);
} catch (EntityStoreException e) {
throw new ConstructionException("Could not create new entity in store", e);
}
}
Aggregations