Skip to content

Force to coalesce be more genereic #683

@kamilkrzywanski

Description

@kamilkrzywanski

In project, the coalesce method has two variations:

coalesce(Expression expr), which is typesafe
coalesce(Expression<?>... exprs), which is not strictly typesafe
Under Hibernate 5, both methods functioned as expected. However, during migration to Hibernate 6, it appears that Hibernate now enforces stricter type safety requirements. This change causes compatibility issues, resulting in errors such as:

java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected CHAR got NUMBER
Could not prepare statement [incompatible data types in combination in statement]
These errors suggest that the second method (coalesce(Expression<?>... exprs)) now requires type safety, even when used with mixed or dynamic types.

Reproduction Steps
Apply the attached patch to your project:
coalesce_bug.patch
Run the tests.
This should reproduce the issue, demonstrating the impact of Hibernate 6’s stricter type requirements.

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