Revision b1653604
Added by Patrick Plitzner over 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SingleReadPherogramCollectionDetailSection.java | ||
---|---|---|
13 | 13 |
import java.util.Collections; |
14 | 14 |
|
15 | 15 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
16 |
import eu.etaxonomy.cdm.api.service.IMediaService; |
|
16 | 17 |
import eu.etaxonomy.cdm.model.media.Media; |
17 | 18 |
import eu.etaxonomy.cdm.model.molecular.SingleRead; |
19 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
18 | 20 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
19 | 21 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
20 | 22 |
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection; |
... | ... | |
69 | 71 |
public void addElement(Media element) { |
70 | 72 |
if(getEntity().getPherogram()==null){ |
71 | 73 |
getEntity().setPherogram(element); |
74 |
/* |
|
75 |
* merge to avoid duplicate key exception |
|
76 |
* the exception seems to be caused by the two links to the Media object: |
|
77 |
* - SingleRead->pherogram (used to be not in the cache after saving) |
|
78 |
* - MediaRepresentationPart->media |
|
79 |
* Invoking merge() solves this problem |
|
80 |
*/ |
|
81 |
CdmStore.getService(IMediaService.class).merge(element); |
|
72 | 82 |
} |
73 | 83 |
} |
74 | 84 |
|
Also available in: Unified diff
Fix multiple key exception for sequence->contigFile and
singleRead->pherogram