Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The generated SQL statement order by is incorrect #1894

Open
MindaDai opened this issue Apr 23, 2024 · 1 comment
Open

The generated SQL statement order by is incorrect #1894

MindaDai opened this issue Apr 23, 2024 · 1 comment

Comments

@MindaDai
Copy link

Description

The generated SQL statement order by is incorrect
PagedList<CasePageCloseResp> pagedList = factory .select( Projections.bean( CasePageCloseResp.class, qClose.closeResult, qClose.closeTime, qClose.verdictAmount, qClose.closeAmount, qCase.id, qCase.name, qCase.type, qCase.causeId, qCase.number, qCase.status, qCase.amount, qCase.lawsuitStatus, qCase.createTime, qCase.updateTime, qCase.director)) .from(qCase) .leftJoin(qClose) .on(qCase.id.eq(qClose.caseId)) .where(where) .orderBy(qCase.number.desc(), qCase.id.desc()) .fetchPage((int) pageable.getOffset(), pageable.getPageSize());

Expected behavior

ORDER BY
CASE

	WHEN casepojo0_.number IS NULL THEN
	1 ELSE 0 
END,
casepojo0_.number DESC

Actual behavior

ORDER BY
casepojo3_.numbercase
WHEN IS NULL THEN
1 ELSE 0
END
The 'number' property and 'CASE' need space

Steps to reproduce

Environment

Version: 1.6.11
JPA-Provider: Hibernate 5.6.15
DBMS: MYSQL 5.7
Application Server: jdk8

image

@beikov
Copy link
Member

beikov commented Apr 23, 2024

Hey and thanks for the report. Please provide a test case for this based on one of our quickstarts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants