@CheckHQL is not reporting error when non-existing enum constant is referenced in named HQL query

Description

When entity class is annotated with @CheckHQL annotation, named querries should be analyzed and errors reported during processing phase.

However, if non-existing constant of otherwise valid enum is referenced, it is treated as any valid constant and no error is reported until that named query is actually used

It seems that behaviour of @CheckHQL usage has never been tested in any test class. Most likely this is due to fact that this can not be simply tested in strict isolation. Therefore, I have created minimal example demonstrating that problem on github

Additionally, I will create example showing other effect of this bug and suggestion how to fix that.

Attachments

1

Activity

Gavin KingMay 13, 2024 at 12:52 PM

Yeah, you are right, and I was wrong.

Čedomir IgalyMay 13, 2024 at 12:47 PM

Now I have created pull request with test case (however, without @CheckHQL) that is showing the problem and patch to fix it.

 

If merged with PR 8095 first commit should be disregarded.

Čedomir IgalyMay 13, 2024 at 12:24 PM

No, PR to solve 17782 (and 17901) is not fixing this. It is working without reporting an error. Attached is generated CookBook_ class

 

When @CheckHQL is not used method

CookBook_.findGoodBooks

should not be generated

Čedomir IgalyMay 13, 2024 at 12:12 PM

Similar, but not duplicate.I’ve tried patches from PR solving issues you’ve mentioned, but it seems that it is still not fixing my problem.

 

Anyway, I will check once again with example I’ve made on github.

Gavin KingMay 13, 2024 at 12:04 PM

Dupe of probably.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created May 13, 2024 at 11:59 AM
Updated June 14, 2024 at 3:08 PM
Resolved May 13, 2024 at 7:07 PM