[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5915) Bug with MSSQL Paging released in 3.6.1

Gail Badner (JIRA) noreply at atlassian.com
Wed May 4 15:54:59 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5915?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner updated HHH-5915:
-----------------------------

    Fix Version/s:     (was: 3.6.3)
                       (was: 4.0.0.Alpha3)

> Bug with MSSQL Paging released in 3.6.1
> ---------------------------------------
>
>                 Key: HHH-5915
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5915
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core, entity-manager
>    Affects Versions: 3.6.1
>         Environment: Hibernate 3.6.1, MSSSQL 2008 R2, JPA 2
>            Reporter: Noel Trout
>            Assignee: Strong Liu
>         Attachments: MSSQLPagingTest.java, org.hibernate.ejb.test.query.MSSQLPagingTest-output.txt, org.hibernate.ejb.test.query.MSSQLPagingTest.txt, README.txt
>
>
> This is related to all the changes in 3.6.1 for MSSQL (specifically paging).
> http://opensource.atlassian.com/projects/hibernate/secure/IssueNavigator.jspa?mode=hide&requestId=11206
> When using the new paging, it is no longer possible to create an entity manager criteria query (javax.persistence.criteria) that takes parameters in the ORDER BY portion of the statement at the same time as the WHERE portion has parameters.  Hibernate does not throw an exception, but the parameters are bound incorrectly so that when the query is sent to MSSQL a grammar exception is thrown.  This is related in some way to how the dialect is transforming the query for the MSSQL Common Table Expression (CTE).
> Literal values still work in the ORDER BY portion.
> To reproduce, just create query an entity, ensuring there are parameters in both the ORDER BY and WHERE portions.
> Example WHERE from Our Code:
> criteriaQuery.where(builder.or(
> criteriaBuilder.equal(aircraftRoot.get(AircraftEntityImpl_.status), AircraftStatus.PAX_ACTIVE),
> criteriaBuilder.equal(aircraftRoot.get(AircraftEntityImpl_.status), AircraftStatus.PAX_CARGO_ACTIVE)
> ));
> Example ORDER BY from our code:
> // Broken as of 3.6.1, parameter bound - enum class with EnhancedUserType
> final Case<Object> wyvernCase = builder.selectCase();
> wyvernCase.when(builder.isNull(wyvernStatusPath), WyvernOperatorStatus.NONE);
> wyvernCase.otherwise(wyvernStatusPath);
> criteriaQuery.orderBy(criteriaBuilder.desc(wyvernCase));
> // Working with 3.6.1, integer literal constant
> final Case<Object> wyvernCase = builder.selectCase();
> wyvernCase.when(builder.isNull(wyvernStatusPath), builder.literal(WyvernOperatorStatus.NONE.getCode()));
> wyvernCase.otherwise(wyvernStatusPath);
> criteriaQuery.orderBy(criteriaBuilder.desc(wyvernCase));

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list