[JIRA] (HHH-13949) Hibernate doesn't generate metamodel for JPMS module
by P (JIRA)
P ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYWU5MjFjMzE2... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiYWU5Mj... ) HHH-13949 ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiYWU5Mj... ) Hibernate doesn't generate metamodel for JPMS module ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiYWU5Mj... )
Change By: P ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
I don't know if it bug, but I asked this question on SO [here|https://stackoverflow.com/questions/61233419/is-it-possible-to-gener... got no answer.
I have a java module with JPA entities and persistence.xml and I want to generate metamodel with Java 11. I tried two variants.
*Variant 1*
{code:java}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.14.Final</version>
</annotationProcessorPath>
<path>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</path>
<path>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</path>
</annotationProcessorPaths>
</configuration>
<dependencies>
</dependencies>
</plugin>
{code}
Result:
{code:java}
Caused by: java.lang.NullPointerException
at org.hibernate.jpamodelgen.ClassWriter.writeGeneratedAnnotation(ClassWriter.java:202)
at org.hibernate.jpamodelgen.ClassWriter.generateBody(ClassWriter.java:100)
at org.hibernate.jpamodelgen.ClassWriter.writeFile(ClassWriter.java:53)
at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.createMetaModelClasses(JPAMetaModelEntityProcessor.java:145)
at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.process(JPAMetaModelEntityProcessor.java:135)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:972)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:888)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1214)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1326)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1258)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:936)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
... 28 more
{code}
*Variant 2*
{code:java}
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>3.3.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<compilerArguments>-AaddGeneratedAnnotation=false</compilerArguments>
<processors>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</processors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.14.Final</version>
</dependency>
</dependencies>
</plugin>
{code}
Result a lot of errors like the following:
{code:java}
[ERROR] diagnostic: /home/<deleted>/src/main/java/module-info.java:11: error: module not found: org.slf4j
requires org.slf4j;
^
[ERROR] diagnostic: /home/<deleted>/src/main/java/module-info.java:15: error: module not found: java.persistence
requires java.persistence;
^
{code}
It seems that hibernate metamodel generator can't work with JPMS modules. Either I do something wrong.
( https://hibernate.atlassian.net/browse/HHH-13949#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13949#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100124- sha1:fb83546 )
4 years, 5 months
[JIRA] (HHH-13949) Hibernate doesn't generate metamodel for JPMS module
by P (JIRA)
P ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOGQyZWIzZjU2... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiOGQyZW... ) HHH-13949 ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiOGQyZW... ) Hibernate doesn't generate metamodel for JPMS module ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiOGQyZW... )
Issue Type: Bug Affects Versions: 5.4.14 Assignee: Unassigned Components: hibernate-jpamodelgen Created: 15/Apr/2020 11:07 AM Priority: Major Reporter: P ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
I don't know if it bug, but I asked this question on SO here ( https://stackoverflow.com/questions/61233419/is-it-possible-to-generate-h... ) but got no answer.
I have a java module with JPA entities and persistence.xml and I want to generate metamodel. I tried two variants.
*Variant 1*
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.14.Final</version>
</annotationProcessorPath>
<path>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</path>
<path>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
</path>
</annotationProcessorPaths>
</configuration>
<dependencies>
</dependencies>
</plugin>
Result:
Caused by: java.lang.NullPointerException
at org.hibernate.jpamodelgen.ClassWriter.writeGeneratedAnnotation(ClassWriter.java:202)
at org.hibernate.jpamodelgen.ClassWriter.generateBody(ClassWriter.java:100)
at org.hibernate.jpamodelgen.ClassWriter.writeFile(ClassWriter.java:53)
at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.createMetaModelClasses(JPAMetaModelEntityProcessor.java:145)
at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.process(JPAMetaModelEntityProcessor.java:135)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:972)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:888)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1214)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1326)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1258)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:936)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
... 28 more
*Variant 2*
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>3.3.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<compilerArguments>-AaddGeneratedAnnotation= false </compilerArguments>
<processors>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</processors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>5.4.14.Final</version>
</dependency>
</dependencies>
</plugin>
Result a lot of errors like the following:
[ERROR] diagnostic: /home/<deleted>/src/main/java/module-info.java:11: error: module not found: org.slf4j
requires org.slf4j;
^
[ERROR] diagnostic: /home/<deleted>/src/main/java/module-info.java:15: error: module not found: java.persistence
requires java.persistence;
^
It seems that hibernate metamodel generator can't work with JPMS modules. Either I do something wrong.
( https://hibernate.atlassian.net/browse/HHH-13949#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13949#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100124- sha1:fb83546 )
4 years, 5 months