I'm trying to use the JPA Metamodel generator in Eclipse using the recipes offered in these pages, but Eclipse still isn't generating the desired files and therefore isn't recognizing the use of the metamodel classes and is therefore reporting a <class>_
cannot be resolved to a variable error and not offering a quick fix of importing the <class>_
.
- Ran the Properties command of the project's context menu,and enabled annotation processing, and configured the source directories as shown below. The generated
<class>_.java
files should appear in those directories, right? - Since the files didn't get generated, I added
hibernate-jpamodelgen-6.2.2.Final.jar
to the Factory Path. - Since the files still didn't get generated, I added
jaxb-impl-3.0.2.jar
to the Factory Path.
Since the files are still not getting generated, what would you suggest? Note that I'm using Java 17 and Eclipse 2023-03.
As a workaround, I added annotationProcessor 'org.hibernate.orm:hibernate-jpamodelgen:6.2.+'
to build.gradle, which successfully generated the <class>_.java
files and placed them in build/generated/sources/annotationProcessor/java/main
directory. After adding this directory to the project's classpath with the Properties > Java Build Path > Source > Add Folder command, Eclipse was able to import the <class>_.java
files, but of course refactoring doesn't work as desired.