entity = temp;
BeanProps.copyProps(originalEntity, entity);
}
}
RowToPersist row = metaClass.translateToRow(entity);
DboTableMeta metaDbo = metaClass.getMetaDbo();
if (metaDbo.isEmbeddable())
throw new IllegalArgumentException("Entity type="+entity.getClass().getName()+" can not be saved as it is Embedded Entity. And Embeddable entitites are only saved along with their parent entity");
//This is if we need to be removing columns from the row that represents the entity in a oneToMany or ManyToMany
//as the entity.accounts may have removed one of the accounts!!!
if(row.hasRemoves())
session.remove(metaDbo, row.getKey(), row.getColumnNamesToRemove());
//NOW for index removals if any indexed values change of the entity, we remove from the index
for(IndexData ind : row.getIndexToRemove()) {
session.removeFromIndex(metaDbo, ind.getColumnFamilyName(), ind.getRowKeyBytes(), ind.getIndexColumn());
}
//NOW for index adds, if it is a new entity or if values change, we persist those values
for(IndexData ind : row.getIndexToAdd()) {
session.persistIndex(metaDbo, ind.getColumnFamilyName(), ind.getRowKeyBytes(), ind.getIndexColumn());
}
byte[] virtKey = row.getVirtualKey();
List<Column> cols = row.getColumns();
session.put(metaDbo, virtKey, cols);
}