Cannot generate JPA Hibernate Metamodel classes in IntelliJ IDEA
Asked Answered
M

1

6

In my Java project, I get "java: cannot find symbol" errors pointing Metamodel classes e.g. Company_.

So, first I checked my-project\target\generated-sources\annotations and see that it is empty. Then, after several search on the web and SO, I see that the necessary settings seems to be ok and this is the first time I get this problem.

Here is corresponding settings in pom.xml:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-jpamodelgen</artifactId>
    <version>5.3.7.Final</version>
</dependency>

And I have already had this settings and these have not been changed:

Settings

Settings > Build execution, Deployment > Compiler > Annotation Processors > my-project (selected) :
Enable annotation processing (checked)
Obtain processors from project classpath (selected)
Store generated sources relative to: Module content root
Production sources directory: target\generated-sources\annotations
Test sources directory: target\generated-test-sources\test-annotations

I tried to rebuild project, module, etc. but there is still nothing in my-project\target\generated-sources\annotations directory. So, how can I generate these JPA Hibernate Metamodel classes in IntelliJ IDEA?

Mycosis answered 10/11, 2021 at 6:24 Comment(1)
Does anybody else have ever used JPA Hibernate Metamodel classes in IntelliJ IDEA?Mycosis
T
0

Try remove .Final from version or just use another version

Toughie answered 10/11, 2021 at 6:40 Comment(6)
I tried <version>5.5.6</version> and Rebuild project after Reloading all Maven project. But still the same problem. Is there any step that I should apply e.g. Invalidating caches?Mycosis
Sometimes refresh maven dependency and rebuild project help.Toughie
Do you mean clicking "Reload all Maven projects" button? I did it, and already Rebuild project. It is really too strange.Mycosis
"Do you mean clicking "Reload all Maven projects" button? " yes. As I remember all time when I had similar situation I've just changed version of dependency. Unfortunately I don't know why it doesn't work.Toughie
Switching to another branch and then rebuilding + reloading all maven dependency SEEMS TO solve the problem, but when I debug the app, it throws the same errors again :(Mycosis
Finally I fixed the problem by deleting and re-creating the branch that has problem. Thanks a lot for your helps.Mycosis

© 2022 - 2024 — McMap. All rights reserved.