use of org.opennms.netmgt.bsm.persistence.api.functions.reduce.AbstractReductionFunctionEntity in project opennms by OpenNMS.
the class BusinessServiceManagerImpl method setReduceFunction.
@Override
public void setReduceFunction(final BusinessService businessService, final ReductionFunction reductionFunction) {
// This is a workaround for a hibernate bug which does not remove
// orphan elements if the element is replaced using the setter. See:
// https://hibernate.atlassian.net/browse/HHH-6484
final BusinessServiceEntity entity = this.getBusinessServiceEntity(businessService);
final AbstractReductionFunctionEntity prevReduceFunctionEntity = entity.getReductionFunction();
if (prevReduceFunctionEntity != null && prevReduceFunctionEntity.getId() != null) {
this.reductionFunctionDao.delete(prevReduceFunctionEntity);
}
final AbstractReductionFunctionEntity reduceFunctionEntity = new ReduceFunctionMapper().toPersistenceFunction(reductionFunction);
entity.setReductionFunction(reduceFunctionEntity);
}
Aggregations