public void save_cascadeMerge() {
long VALID_PREFERENCE_ID = addPreferenceToRegionWidget(VALID_REGION_WIDGET_ID);
RegionWidget regionWidget = new JpaRegionWidget(VALID_REGION_WIDGET_ID);
regionWidget.setPreferences(new ArrayList<RegionWidgetPreference>());
JpaRegionWidgetPreference regionWidgetPreference = new JpaRegionWidgetPreference(VALID_PREFERENCE_ID,
VALID_REGION_WIDGET_ID, VALID_PREFERENCE_NAME, VALID_PREFERENCE_VALUE);
regionWidget.getPreferences().add(regionWidgetPreference);
RegionWidget saved = repository.save(regionWidget);
manager.flush();
assertThat(saved.getPreferences().size(), is(equalTo(1)));
JpaRegionWidgetPreference actual = (JpaRegionWidgetPreference)saved.getPreferences().get(0);
assertThat(actual, is(not(sameInstance(regionWidgetPreference))));
assertThat(actual.getEntityId(), is(equalTo(regionWidgetPreference.getEntityId())));
}