Source:
<code>public void changeRelation() throws Exception { String idmea = "1101"; String idparamset = "1002"; ModelManager modelManager = entityManager.getModelManager().get(); SearchService searchService = entityManager.getSearchService().get(); EntityType etmeasurement = modelManager.getEntityType(Measurement.class); EntityType etparamset = modelManager.getEntityType(ParameterSet.class); Transaction transaction; try { transaction = entityManager.startTransaction(); } catch (DataAccessException e) { e.printStackTrace(); <START> assert (false); <END> return; } try { List<Measurement> mealist; mealist = searchService.fetch(Measurement.class, Filter.idOnly(etmeasurement, idmea)); assertEquals(1, mealist.size()); Measurement mea = mealist.get(0); List<ParameterSet> paramsetlist = new ArrayList<>(); ParameterSet paramset = entityManager.load(ParameterSet.class, idparamset); paramsetlist.add(paramset); Method GET_CORE_METHOD; try { GET_CORE_METHOD = BaseEntity.class.getDeclaredMethod("getCore"); GET_CORE_METHOD.setAccessible(true); } catch (NoSuchMethodException | SecurityException e) { throw new IllegalStateException( "Unable to load 'getCore()' in class '" + BaseEntity.class.getSimpleName() + "'.", e); } Core core = (Core) GET_CORE_METHOD.invoke(paramset); EntityStore store = core.getMutableStore(); store.set(mea); assertEquals(core.getMutableStore().get(Measurement.class), mea); transaction.update(paramsetlist); transaction.commit(); MeasurementSearchQuery mq = new MeasurementSearchQuery((ODSModelManager) modelManager, ContextState.MEASURED); List<EntityType> fetchList = new ArrayList<>(); fetchList.add(etmeasurement); List<Result> fetch = mq.fetchComplete(fetchList, Filter.idOnly(etparamset, idparamset)); assertEquals(fetch.size(), 1); Record record = fetch.get(0).getRecord(etmeasurement); assertNotNull(record); assertEquals(record.getID(), idmea); } catch (RuntimeException | IllegalAccessException | InvocationTargetException | DataAccessException e) { transaction.abort(); throw e; } }</code><technical_language>is another one</technical_language>

Target:
public void changeRelation() throws Exception { String idmea = "1101"; String idparamset = "1002"; ModelManager modelManager = entityManager.getModelManager().get(); SearchService searchService = entityManager.getSearchService().get(); EntityType etmeasurement = modelManager.getEntityType(Measurement.class); EntityType etparamset = modelManager.getEntityType(ParameterSet.class); Transaction transaction; transaction = entityManager.startTransaction(); try { List<Measurement> mealist; mealist = searchService.fetch(Measurement.class, Filter.idOnly(etmeasurement, idmea)); assertEquals(1, mealist.size()); Measurement mea = mealist.get(0); List<ParameterSet> paramsetlist = new ArrayList<>(); ParameterSet paramset = entityManager.load(ParameterSet.class, idparamset); paramsetlist.add(paramset); Method GET_CORE_METHOD; try { GET_CORE_METHOD = BaseEntity.class.getDeclaredMethod("getCore"); GET_CORE_METHOD.setAccessible(true); } catch (NoSuchMethodException | SecurityException e) { throw new IllegalStateException( "Unable to load 'getCore()' in class '" + BaseEntity.class.getSimpleName() + "'.", e); } Core core = (Core) GET_CORE_METHOD.invoke(paramset); EntityStore store = core.getMutableStore(); store.set(mea); assertEquals(core.getMutableStore().get(Measurement.class), mea); transaction.update(paramsetlist); transaction.commit(); MeasurementSearchQuery mq = new MeasurementSearchQuery((ODSModelManager) modelManager, ContextState.MEASURED); List<EntityType> fetchList = new ArrayList<>(); fetchList.add(etmeasurement); List<Result> fetch = mq.fetchComplete(fetchList, Filter.idOnly(etparamset, idparamset)); assertEquals(fetch.size(), 1); Record record = fetch.get(0).getRecord(etmeasurement); assertNotNull(record); assertEquals(record.getID(), idmea); } catch (RuntimeException | IllegalAccessException | InvocationTargetException | DataAccessException e) { transaction.abort(); throw e; } }