JPMS appeared in Java 9, now Java 14 is available. Starting from Java 9 we have two types of path:
# – class-path # --module-path.
If JPMS is used in application then, as a rule, no class-path is used.
So I suggest to add scanning for persistence.xml also in module-path if Java9+. Although according to JPA specs persistence.xml file has to be located in the META-INF directory in the classpath, all we know that there was no JPMS when JPA specs was written.
At the same time module Hibernate as JPA provider - path scanning > persistence.xml must be enabled only explicitly for example via java system property.
At the same time JPMS layers can be created dynamically and modules that are not on -- classpath, but now there is module-path and class-path can be added there not used at all .
I suggest to create spi service that will be used by hibernate to get path (for example, URL) to persistence.xml files. It can be optional. |
|