Project

General

Profile

« Previous | Next » 

Revision 495cf16b

Added by Katja Luther 5 months ago

ref #9907: fix missing treeIndex in taxonNodeDto - continue

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonNodeDaoHibernateImpl.java
233 233
    private Query createQueryForUuidAndTitleCache(Integer limit, UUID classificationUuid, String pattern, boolean includeDoubtful){
234 234
        String doubtfulPattern = "";
235 235
        String queryString = "SELECT new " + SortableTaxonNodeQueryResult.class.getName() + "("
236
                + " node.uuid, node.id, t.titleCache, rank, parent.uuid"
236
                + " node.uuid, node.id, node.treeIndex, t.uuid, t.titleCache, rank, parent.uuid"
237 237
                + ") "
238 238
                + " FROM TaxonNode AS node "
239 239
                + "   JOIN node.taxon as t " // FIXME why not inner join here?
......
1176 1176
    public TaxonNodeDto getTaxonNodeDto(UUID nodeUuid) {
1177 1177

  
1178 1178
        String queryString = getTaxonNodeDtoQuery();
1179
        queryString += " WHERE t.uuid LIKE :uuid ";
1179
        queryString += " WHERE tn.uuid = :uuid ";
1180 1180
        Query query =  getSession().createQuery(queryString);
1181
        query.setParameter("uuid", nodeUuid.toString());
1181
        query.setParameter("uuid", nodeUuid);
1182 1182

  
1183 1183
        @SuppressWarnings("unchecked")
1184 1184
        List<SortableTaxonNodeQueryResult> result = query.list();
......
1192 1192
     */
1193 1193
    private String getTaxonNodeDtoQuery() {
1194 1194
        String queryString = "SELECT new " + SortableTaxonNodeQueryResult.class.getName() + "("
1195
                + "tn.uuid, tn.id, t.titleCache, name.titleCache, rank, p.uuid "
1195
                + "tn.uuid, tn.id, tn.treeIndex, t.uuid, t.titleCache, name.titleCache, rank, p.uuid "
1196 1196
                + ") "
1197 1197
                + " FROM TaxonNode tn "
1198 1198
                + "   INNER JOIN tn.taxon AS t "
......
1230 1230
        List<TaxonNodeDto> nodeDtos = new ArrayList<>();
1231 1231
        Collections.sort(result, new SortableTaxonNodeQueryResultComparator());
1232 1232
        for(SortableTaxonNodeQueryResult queryDTO : result){
1233
            TaxonNodeDto nodeDto = new TaxonNodeDto(queryDTO.getTaxonNodeUuid(), queryDTO.getTaxonNodeId(), queryDTO.getNameTitleCache(), queryDTO.getTaxonTitleCache(), queryDTO.getNameRank().getOrderIndex(), queryDTO.getParentNodeUuid());
1233
            TaxonNodeDto nodeDto = new TaxonNodeDto(queryDTO.getTaxonNodeUuid(), queryDTO.getTaxonNodeId(), queryDTO.getTreeIndex(), queryDTO.getNameTitleCache(), queryDTO.getTaxonTitleCache(), queryDTO.getNameRank().getOrderIndex(), queryDTO.getParentNodeUuid());
1234 1234
            nodeDtos.add(nodeDto);
1235 1235
        }
1236 1236
        return nodeDtos;

Also available in: Unified diff