Project

General

Profile

« Previous | Next » 

Revision cb291ebd

Added by Andreas Müller over 2 years ago

ref #9814 fix vocabularyDtos caching

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/term/DefinedTermDaoImpl.java
799 799
        Query vocQuery = getSession().createQuery(vocQueryString);
800 800
        Map<UUID,TermVocabularyDto> vocMap = new HashMap<>();
801 801
        for (TermDto dto: list){
802

  
802 803
            UUID vocUuid = dto.getVocabularyUuid();
803
            if (vocMap.get(vocUuid) == null){
804
            TermVocabularyDto vocDto = vocMap.get(vocUuid);
805
            if (vocDto == null){
804 806
                vocQuery.setParameter("uuid", dto.getVocabularyUuid());
805 807
                @SuppressWarnings("unchecked")
806 808
                List<Object[]> vocArrayResult = vocQuery.list();
807 809
                List<TermVocabularyDto> vocs = TermVocabularyDto.termVocabularyDtoListFrom(vocArrayResult);
808 810
                if (!vocs.isEmpty()){
809
                    dto.setVocabularyDto(vocs.get(0));
811
                    vocDto = vocs.get(0);
810 812
                    vocMap.put(vocUuid, vocs.get(0));
811 813
                }
812 814
            }
815
            dto.setVocabularyDto(vocDto);
813 816
        }
814 817

  
815 818
        return list;

Also available in: Unified diff