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
Updated by Andreas Kohlbecker over 3 years ago
- Copied from feature request #7966: Registration search simplify type select options added
Updated by Andreas Kohlbecker over 3 years ago
- Related to feature request #8330: RegistrationDao search method added
Updated by Andreas Kohlbecker over 3 years ago
- Status changed from New to In Progress
Updated by Andreas Kohlbecker over 3 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 50
Applied in changeset cdmlib|c40f420c355ee29b3b31e575c8d630f59cf55c0e.
Updated by Andreas Kohlbecker over 3 years ago
- Assignee changed from Andreas Kohlbecker to Wolf-Henning Kusber
please review
Updated by Andreas Kohlbecker over 3 years ago
- Target version changed from Release 5.10 to Release 5.8
Updated by Wolf-Henning Kusber over 3 years ago
- Assignee changed from Wolf-Henning Kusber to Andreas Kohlbecker
- % Done changed from 50 to 100
combination of types and none are searchable without errors in Vaadin and the portal. If this is the feedback for this ticket, it can be closed.
Updated by Andreas Kohlbecker over 3 years ago
- Status changed from Resolved to Closed