PL-7960 Could not create instance of BaseIntegerId or BaseLongId entity in additional datastore if the autoincrement property is not set for ID

This commit is contained in:
Konstantin Krivopustov 2017-11-30 18:16:53 +04:00
parent 6ec0bd3b77
commit 050116f1ba

View File

@ -143,10 +143,6 @@ public class MetadataImpl implements Metadata {
Entity key = create(primaryKeyProperty.getRange().asClass());
((BaseGenericIdEntity) entity).setId(key);
} else {
// assign autogenerated ID only if the entity is stored to the main database
if (!Stores.MAIN.equals(tools.getStoreName(metaClass)))
return;
if (entity instanceof BaseLongIdEntity) {
((BaseGenericIdEntity<Long>) entity).setId(numberIdSource.createLongId(getEntityNameForIdGeneration(metaClass)));
} else if (entity instanceof BaseIntegerIdEntity) {