I'm trying to generate Metamodel classes with Hibernate in IntelliJ idea. I already saw oldest tutorials, but they didn't help me. There are any other way to generate that files? The topics that I found about Metamodel support in IntelliJ are too old. Maybe I'm doing something wrong. I'll explain what I'm doing.
I've already tried:
Enable the processing in IntelliJ settings: Settings > Build, Execution, Deployment > Compiler > Annotation Processors > [check] Enable annotation processing.
Put the maven-processor in pom.xml. ( jpa.modelgen.CanonicalModelProcessor
)
Rebuilt the project.
Plugin that I included in pom.xml:
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>1.3.5</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/metamodel</outputDirectory>
<compilerArguments>
-Aeclipselink.persistencexml=${project.basedir}/src/main/resources/META-INF/persistence.xml
</compilerArguments>
<processors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
</processor>
</processors>
</configuration>
</execution>
</executions>
</plugin>
Put following dependency in pom.xml of project.
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-jpamodelgen -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.3.7.Final</version>
<scope>provided</scope>
</dependency>
Then use ..path_to_root_directory_of_module_of_entities/target/classes/
directory on the build path of module/project. It will make available all auto generated static model classes to the runtime of project.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.