Skip to content

NULLS FIRST not supported by SQLServer #2782

Description

@mswatosh

Describe the bug
When writing JPQL similar to this:

SELECT o FROM SomeEntity o ORDER BY o.someNullableField NULLS FIRST

The query generated for SQLServer directly contains NULLS FIRST, which is not supported by SQLServer.

  • EclipseLink version: 5.0.0.v202603230926-bc4f4eb36eb1dcce223533d87890ba458628a2f9
  • Java/JDK version: N/A
  • DataBase: SQLServer 2022

Additional context
Looks like the standard way of handling this is

https://stackoverflow.com/a/1456681
ORDER BY (CASE WHEN [Order] IS NULL THEN 0 ELSE 1 END), [Order]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions