-
Notifications
You must be signed in to change notification settings - Fork 43
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
NaturalIdCacheEvent is triggered even when having the @NaturalIdCache in place #245
Comments
Thanks for reporting it. I will try to replicate it according to your indications. |
@rameshsahydstgdn I build this example to replicate the issue. I assume you added the If you activate the second-level cache via the So, in this case, I could change the message of the |
Thank you for the suggestion! Issue resolved by activating the second-level cache. |
@rameshsahydstgdn I will reopen it in order to investigate a way to change the message based on whether the second-level cache is active or not. |
Issue Summary:
The Hypersistence Optimizer is suggesting to add the @NaturalIdCache annotation to entities that already have it, specifically when using natural identifiers. This recommendation appears even when the annotation is correctly applied at the entity level.
Steps to Reproduce:
Define an entity in Hibernate with natural identifiers (@naturalid).
Apply the @NaturalIdCache annotation to the entity class.
Run the Hypersistence Optimizer or integrate it into a Spring Boot application.
Observe the generated NaturalIdCacheEvent warning.
Expected Behavior:
The Hypersistence Optimizer should recognize that @NaturalIdCache is already present on the entity and not suggest adding it again, assuming it's correctly placed.
Actual Behavior:
The optimizer suggests adding @NaturalIdCache even when it is already used in the entity definition. This can lead to confusion and unnecessary recommendations in the optimization report.
Environment:
Hypersistence Optimizer version: 2.9.0, classifier: jakarta
Hibernate version: 6.5.2.Final
Spring Boot version: 3.3.0
Database: postgresql:16
The text was updated successfully, but these errors were encountered: