bug #8287
closedRegistrationServiceImpl.page( .... Collection<UUID> typeDesignationStatusUuids ... ) fails when NULL and UUIDs are passed
100%
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:
- implement dedicated dao method #8330
- re-enable search form multiselect, see cdm-dataportal|a0d2a22c
Related issues