Revision 4e201def
Added by Andreas Müller about 8 years ago
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/common/DeduplicationHelper.java | ||
---|---|---|
143 | 143 |
if (toBeDeleted != cdmBase2){ |
144 | 144 |
session.delete(toBeDeleted); |
145 | 145 |
} |
146 |
|
|
147 | 146 |
} |
148 | 147 |
} |
149 | 148 |
|
150 |
|
|
151 |
|
|
152 | 149 |
//flush |
153 | 150 |
session.flush(); |
154 | 151 |
|
155 | 152 |
} catch (Exception e) { |
156 |
throw new MergeException(e); |
|
153 |
e.printStackTrace(); |
|
154 |
throw new MergeException(e); |
|
157 | 155 |
} |
158 | 156 |
} |
159 | 157 |
|
... | ... | |
517 | 515 |
Object collection = referencingField.get(referencingObject); |
518 | 516 |
if (! (collection instanceof Collection)){ |
519 | 517 |
throw new MergeException ("Reallocation of collections for collection other than set and list not yet implemented"); |
518 |
}else if (collection instanceof List){ |
|
519 |
Method replaceMethod = DefaultMergeStrategy.getReplaceMethod(referencingField); |
|
520 |
replaceMethod.invoke(referencingObject, cdmBase1, cdmBase2); |
|
521 |
}else{ |
|
522 |
Method addMethod = DefaultMergeStrategy.getAddMethod(referencingField, false); |
|
523 |
Method removeMethod = DefaultMergeStrategy.getAddMethod(referencingField, true); |
|
524 |
addMethod.invoke(referencingObject, cdmBase1); |
|
525 |
removeMethod.invoke(referencingObject, cdmBase2); |
|
520 | 526 |
} |
521 |
Method addMethod = DefaultMergeStrategy.getAddMethod(referencingField, false); |
|
522 |
Method removeMethod = DefaultMergeStrategy.getAddMethod(referencingField, true); |
|
523 |
addMethod.invoke(referencingObject, cdmBase1); |
|
524 |
removeMethod.invoke(referencingObject, cdmBase2); |
|
525 | 527 |
} |
526 | 528 |
} |
527 | 529 |
|
Also available in: Unified diff
Fix deduplication problem with list order #5652