Project

General

Profile

Actions

bug #8287

closed

RegistrationServiceImpl.page( .... Collection<UUID> typeDesignationStatusUuids ... ) fails when NULL and UUIDs are passed

Added by Andreas Kohlbecker almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
New
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
normal
Found in Version:
Tags:

Description

In case the collection of typeDesignationStatusUuids contains both, a null value and UUIDs the request fails.

This is caused by a bug in CdmEntityDaoBase.addRestrictions(List<Restriction<?>> restrictions, DetachedCriteria criteria) where the implementation fails to distinguish aliases for different JOIN methods. This causes the method to attempt create the same alias name two times, which finally result in:

org.hibernate.QueryException: duplicate alias: typeDesignations
    at org.hibernate.loader.criteria.CriteriaQueryTranslator.createAliasCriteriaMap(CriteriaQueryTranslator.java:141)
    at org.hibernate.loader.criteria.CriteriaQueryTranslator.<init>(CriteriaQueryTranslator.java:92)
    at org.hibernate.loader.criteria.CriteriaQueryTranslator.<init>(CriteriaQueryTranslator.java:78)
    at org.hibernate.criterion.SubqueryExpression.createAndSetInnerQuery(SubqueryExpression.java:129)
    at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:61)
    at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:400)
    at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:95)
    at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:75)
    at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:80)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1760)
    at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363)
    at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:385)
    at eu.etaxonomy.cdm.persistence.dao.hibernate.common.CdmEntityDaoBase.count(CdmEntityDaoBase.java:691)
    at eu.etaxonomy.cdm.api.service.RegistrationServiceImpl.page(RegistrationServiceImpl.java:183)

This problem would actually not become relevant if the the RegistrationServiceImpl.page( .... Collection<UUID> typeDesignationStatusUuids ... ) could be implemented so that the Restriction for typeDesignationStatus=NULL OR typeDesignationStatus.uuis IN (...) would be enclosed in "brackets", which currently is not yet possible with the cdm-Restrictions.

Regarding the page method it would be best to implement a dedicated dao method with tests instead of using the generic list methods with Restriction parameters.

TODO:

  1. implement dedicated dao method #8330
  2. re-enable search form multiselect, see cdm-dataportal|a0d2a22c

Related issues

Related to EDIT - feature request #8330: RegistrationDao search method ClosedAndreas Kohlbecker

Actions
Copied from EDIT - feature request #7966: Registration search simplify type select optionsClosedAndreas Kohlbecker

Actions
Actions

Also available in: Atom PDF