Project

General

Profile

Revision 5f6aa5c3

ID5f6aa5c36530013815865e05c9173145d27b946a
Parent 9ee84720
Child d7d1f114

Added by Katja Luther almost 4 years ago

ref #7013: reload reference in setSecundumReference to avoid NonUniqueObjectException

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonNodeDaoHibernateImpl.java
510 510
            }
511 511

  
512 512
        }
513

  
514 513
      return result;
515 514
    }
516 515

  
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonNodeServiceImpl.java
23 23
import org.apache.log4j.Logger;
24 24
import org.springframework.beans.factory.annotation.Autowired;
25 25
import org.springframework.stereotype.Service;
26
import org.springframework.transaction.annotation.Propagation;
26 27
import org.springframework.transaction.annotation.Transactional;
27 28

  
28 29
import eu.etaxonomy.cdm.api.service.UpdateResult.Status;
......
87 88
    private INameService nameService;
88 89

  
89 90
    @Autowired
91
    private IReferenceService refService;
92

  
93
    @Autowired
90 94
    private ITaxonNodeFilterDao nodeFilterDao;
91 95

  
92 96
    @Autowired
......
782 786
    }
783 787

  
784 788
    @Override
785
    @Transactional
789
    @Transactional(propagation = Propagation.REQUIRES_NEW)
786 790
    public UpdateResult setSecundumForSubtree(SecundumForSubtreeConfigurator config) {
787 791
        UpdateResult result = new UpdateResult();
788 792
       // IProgressMonitor monitor = config.getMonitor();
......
792 796
        }
793 797
        TaxonNode subTree = load(config.getSubtreeUuid());
794 798
        TreeIndex subTreeIndex = null;
799
        Reference newSec = null;
800
        if (config.getNewSecundum() != null){
801
            newSec = refService.load(config.getNewSecundum().getUuid());
802
        }
795 803
        if (subTree != null){
796 804
            subTreeIndex = TreeIndex.NewInstance(subTree.treeIndex());
797 805
            Long count = dao.countChildrenOf(subTree, subTree.getClassification(), true);
......
818 826
        //Reference ref = config.getNewSecundum();
819 827
        if (config.isIncludeAcceptedTaxa()){
820 828
            monitor.subTask("Update Accepted Taxa");
821
            Set<TaxonBase> updatedTaxa = dao.setSecundumForSubtreeAcceptedTaxa(subTreeIndex, config.getNewSecundum(), config.isOverwriteExistingAccepted(), config.isIncludeSharedTaxa(), config.isEmptySecundumDetail());
829

  
830
            Set<TaxonBase> updatedTaxa = dao.setSecundumForSubtreeAcceptedTaxa(subTreeIndex, newSec, config.isOverwriteExistingAccepted(), config.isIncludeSharedTaxa(), config.isEmptySecundumDetail());
822 831
            result.addUpdatedObjects(updatedTaxa);
823 832
        }
824 833
        if (config.isIncludeSynonyms()){
825 834
           monitor.subTask("Update Synonyms");
826
           Set<TaxonBase> updatedSynonyms = dao.setSecundumForSubtreeSynonyms(subTreeIndex, config.getNewSecundum(), config.isOverwriteExistingSynonyms(), config.isIncludeSharedTaxa() , config.isEmptySecundumDetail());
835
           Set<TaxonBase> updatedSynonyms = dao.setSecundumForSubtreeSynonyms(subTreeIndex, newSec, config.isOverwriteExistingSynonyms(), config.isIncludeSharedTaxa() , config.isEmptySecundumDetail());
827 836
           result.addUpdatedObjects(updatedSynonyms);
828 837
        }
829 838

  
......
894 903
    }
895 904

  
896 905
    @Override
906
    @Transactional
897 907
    public UUID monitSetSecundum(final SecundumForSubtreeConfigurator configurator) {
898 908
        RemotingProgressMonitorThread monitorThread = new RemotingProgressMonitorThread() {
899 909
            @Override

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)