[hibernate-issues] [JIRA] (HHH-13949) Hibernate doesn't generate metamodel for JPMS module

P (JIRA) jira at hibernate.atlassian.net
Wed Apr 15 14:10:43 EDT 2020


P ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Aed8a9f32-e1de-429d-b17a-fb86b807af6d ) *updated* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYWU5MjFjMzE2YTRmNDNhYzliZjc2MDRhMjI0NWJiNzIiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiYWU5MjFjMzE2YTRmNDNhYzliZjc2MDRhMjI0NWJiNzIiLCJwIjoiaiJ9 ) HHH-13949 ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiYWU5MjFjMzE2YTRmNDNhYzliZjc2MDRhMjI0NWJiNzIiLCJwIjoiaiJ9 ) Hibernate doesn't generate metamodel for JPMS module ( https://hibernate.atlassian.net/browse/HHH-13949?atlOrigin=eyJpIjoiYWU5MjFjMzE2YTRmNDNhYzliZjc2MDRhMjI0NWJiNzIiLCJwIjoiaiJ9 )

Change By: P ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3Aed8a9f32-e1de-429d-b17a-fb86b807af6d )

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-hibernate-metamodel-for-java-11-and-java-modules]  but 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=eyJpIjoiYWU5MjFjMzE2YTRmNDNhYzliZjc2MDRhMjI0NWJiNzIiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13949#add-comment?atlOrigin=eyJpIjoiYWU5MjFjMzE2YTRmNDNhYzliZjc2MDRhMjI0NWJiNzIiLCJwIjoiaiJ9 )

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.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100124- sha1:fb83546 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200415/baf6e417/attachment.html 


More information about the hibernate-issues mailing list