Static jpa metamodel are not generated with hibernate-jpamodelgen 6.1.5.Final

I know this question has been asked several times but none of the answers worked for me.

Basically, i'm trying to generate the jpa metamodel from my entities in order to use them in specifications. However, despite running (i think, see the rebuild project ouput screenshot), the Hibernate JPA 2 Static-Metamodel Generator 6.1.5.Final didn't generate any classes in the annotations folder.

Can someone please help me? (PS sorry i cannot post screenshot because stack overflow doesn't let me)

I'm using java 19 with sping boot 2.7.5 and maven and intellij.

Here is the file (the class i want to generate):

package com.example.demo.model;

import javax.persistence.Entity;
import javax.persistence.Id;

public class Test {
    private int id;

    public int getId() {
        return id;

    public void setId(int id) { = id;

The pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
      <relativePath/> <!-- lookup parent from repository -->
   <description>Demo project for Spring Boot</description>




The rebuild project output:

Clearing build system data...
Executing pre-compile tasks...
Cleaning output directories…
Running 'before' tasks
Checking sources
Copying resources... [demo]
Parsing java… [demo]
java: Hibernate JPA 2 Static-Metamodel Generator 6.1.5.Final
Writing classes… [demo]
Updating dependency information… [demo]
Adding @NotNull assertions… [demo]
Adding pattern assertions… [demo]
Adding Threading Model assertions… [demo]
Parsing java… [tests of demo]
Writing classes… [tests of demo]
Updating dependency information… [tests of demo]
Adding @NotNull assertions… [tests of demo]
Adding pattern assertions… [tests of demo]
Adding Threading Model assertions… [tests of demo]
Running 'after' tasks
javac 19 was used to compile java sources
Finished, saving caches…
Executing post-compile tasks...
Finished, saving caches…
Synchronizing output directories...
06-11-22 14:37 - Build completed successfully in 3 sec, 464 ms

And the intellij annotation processors settings:

I cannot post images but the enable annotation processing is checked as well as obtain processorts from projet classpath and the path is target\generated-sources\annotations in the module content root.

After rebuilding the project, the target folder appears and contains a folder named generated-sources. This generated-sources contains a folder called annotations but it doesn't contain anything (but it should contain the class Test_).

The folder annotations has been set as a source folder aswell.

I have read some previous posts but none were working for me. I also read the documentation (doc) but it still doesnt work.


  • I have found two solutions but i don't understand why it works (i'm lucky i guess). Any explanations would be great :)

    1. First solution

    Use the version 5.6.12.Final of Hibernate directly in a dependency. If i upgrade it to version 6.1.5.Final (as suggested by intellij), the metamodel are not generated but i don't know why...


    1. Second solution

    Set the dependency to the latest version (here 6.1.5.Final) but add a plugin to the build with an annotationProcessorPaths that use the version 5.6.12.Final


    PS: i don't understand why the variable ${hibernate.version} is set to version 5.6.12.Final while i have set my hibernate verison to 6.1.5.Final in the dependency... Any explanation would be great :)