use of org.opennms.netmgt.bsm.persistence.api.functions.map.AbstractMapFunctionEntity in project opennms by OpenNMS.
the class BusinessServiceManagerImpl method setMapFunction.
@Override
public void setMapFunction(final Edge edge, final MapFunction mapFunction) {
// 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 BusinessServiceEdgeEntity edgeEntity = this.getBusinessServiceEdgeEntity(edge);
final AbstractMapFunctionEntity prevMapFunctionEntity = edgeEntity.getMapFunction();
if (prevMapFunctionEntity != null && prevMapFunctionEntity.getId() != null) {
this.mapFunctionDao.delete(prevMapFunctionEntity);
}
final AbstractMapFunctionEntity mapFunctionEntity = new MapFunctionMapper().toPersistenceFunction(mapFunction);
edgeEntity.setMapFunction(mapFunctionEntity);
}
Aggregations