5

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?

Marek Borecki
  • 402
  • 1
  • 4
  • 20
  • 1
    Does anybody else have ever used `JPA Hibernate Metamodel classes in IntelliJ IDEA`? –  Nov 10 '21 at 06:33

1 Answers1

0

Try remove .Final from version or just use another version

Marek Borecki
  • 402
  • 1
  • 4
  • 20
  • 2
    I tried `5.5.6` 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? –  Nov 10 '21 at 06:54
  • 1
    Sometimes refresh maven dependency and rebuild project help. – Marek Borecki Nov 10 '21 at 06:58
  • 2
    Do you mean clicking "Reload all Maven projects" button? I did it, and already Rebuild project. It is really too strange. –  Nov 10 '21 at 07:27
  • 1
    "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. – Marek Borecki Nov 10 '21 at 07:30
  • 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 :( –  Nov 10 '21 at 07:50
  • 2
    Finally I fixed the problem by deleting and re-creating the branch that has problem. Thanks a lot for your helps. –  Nov 10 '21 at 11:06