JPMS Support for Hibernate ORM


#1

Hello; are there plans to support JPMS modules in Hibernate? This blogpost http://in.relation.to/2018/09/13/using-hibernate-orm-with-jdk11/ does not mention whether modular projects will be supported in the future.


#2

Hibernate IRM should support Java 9 modules. Isn’t this working for your use case? Can you provide us more details about your use case which requires JPMS?


#3

I created a minimal example at https://github.com/AugustNagro/hibernate-jpa-demo

When building with Intellij I get dozens of split package errors such as:

Error:java: module java.persistence reads package javax.persistence.spi from both javaee.api and java.persistence
Error:java: module java.persistence reads package com.sun.xml.bind.util from both jaxb.runtime and jaxb.core
Error:java: module org.jboss.logging reads package com.sun.xml.bind.api from both jaxb.runtime and jaxb.core

What’s strange is that this project builds fine with maven with the warning

Required filename-based automodules detected. Please don't publish this project to a public artifact repository!

Is there something wrong with my pom.xml here? Or is this an Intellij issue?


#4

Try adding these 2 dependencies:

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.3.0</version>
</dependency>

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.3.0</version>
</dependency>

For more details, check out this Java EE GitHub issue.


#5

Thanks for the fast response. This does not fix the issue on intellij, but maven still runs.

JaxB 2.3.0 is the same version Gunnar created the issue with, no? Intellij also reports split packages like

Error:java: the unnamed module reads package javax.persistence.criteria from both java.persistence and javaee.api

So I wonder if this is a purely JaxB issue


#6

If it works with Maven, but not with IntelliJ IDEA, it could be the IDE fault. Try upgrading to a newer version.