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

Clarification on Join Behavior with @SoftDelete in Paginated Criteria Queries #1980

Open
mattae opened this issue Dec 29, 2024 · 1 comment
Labels

Comments

@mattae
Copy link

mattae commented Dec 29, 2024

I would like to seek clarification regarding the behavior of implicit joins when using Hibernate's @SoftDelete annotation in combination with a @ManyToOne relationship, particularly when the related entity is soft-deleted.

By default, implicit joins are usually generated as JOIN. This behavior can typically be adjusted using Blaze Persistence's joinDefault configuration. However, when the query involves pagination, the configured join type does not appear to take effect. Even when explicitly specifying the join type using joinOn, the generated query consistently includes a default JOIN to the soft-deleted entity.

Is this behavior expected, or is there an alternative approach to ensure the desired join type is respected in paginated queries?

Version:
Blaze-Persistence: 1.6.14
JPA-Provider: Hibernate 6.6.2.Final
DBMS: PostgreSQL 16
Application: Spring Boot 3.4.0

@beikov
Copy link
Member

beikov commented Dec 30, 2024

Hi, when fetching entities, Hibernate ORM has to eagerly join such associations to determine nullity. You could use Entity-Views instead, or enable enhancement to defer the join/query to the first access of the association.

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

No branches or pull requests

2 participants