Project

General

Profile

« Previous | Next » 

Revision 737221ab

Added by Patrick Plitzner about 6 years ago

ref #7674 Fix lazy init exception

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/DescriptiveDataSetService.java
42 42
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
43 43
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
44 44
import eu.etaxonomy.cdm.model.taxon.Classification;
45
import eu.etaxonomy.cdm.model.taxon.Taxon;
45 46
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
46 47
import eu.etaxonomy.cdm.persistence.dao.description.IDescriptiveDataSetDao;
47 48
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
......
120 121
                return new ArrayList<>();
121 122
            }
122 123
            RowWrapperDTO rowWrapper = null;
123
            if(description instanceof TaxonDescription){
124
                rowWrapper = createTaxonRowWrapper((TaxonDescription) description, descriptiveDataSet);
124
            if(HibernateProxyHelper.isInstanceOf(description, TaxonDescription.class)){
125
                rowWrapper = createTaxonRowWrapper(HibernateProxyHelper.deproxy(description, TaxonDescription.class), descriptiveDataSet);
125 126
            }
126
            else if (description instanceof SpecimenDescription){
127
                rowWrapper = createSpecimenRowWrapper((SpecimenDescription) description, descriptiveDataSet);
127
            else if (HibernateProxyHelper.isInstanceOf(description, SpecimenDescription.class)){
128
                rowWrapper = createSpecimenRowWrapper(HibernateProxyHelper.deproxy(description, SpecimenDescription.class), descriptiveDataSet);
128 129
            }
129 130
            if(rowWrapper!=null){
130 131
                wrappers.add(rowWrapper);
......
175 176
        Optional<Classification> classificationOptional = first.map(node->node.getClassification());
176 177
        if(classificationOptional.isPresent()){
177 178
            classification = classificationOptional.get();
178
            taxonNode = description.getTaxon().getTaxonNode(classification);
179
            Taxon taxon = (Taxon) taxonService.load(description.getTaxon().getId(), Arrays.asList("taxonNodes", "taxonNodes.classification"));
180
            taxonNode = taxon.getTaxonNode(classification);
179 181
        }
180 182
        return new TaxonRowWrapperDTO(description, taxonNode);
181 183
    }

Also available in: Unified diff