Skip to content

Commit e304059

Browse files
committed
HHH-8821 Scanning for META-INF/orm.xml does not work on Windows in jpa
mode
1 parent bd0892a commit e304059

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hibernate-entitymanager/src/main/java/org/hibernate/jpa/boot/scan/spi/NonClassFileArchiveEntryHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ public void handleEntry(ArchiveEntry entry, ArchiveContext context) {
5959

6060
@SuppressWarnings("SimplifiableIfStatement")
6161
private boolean acceptAsMappingFile(ArchiveEntry entry, ArchiveContext context) {
62-
if ( entry.getName().endsWith( "hbm.xml" ) ) {
62+
if ( entry.getNameWithinArchive().endsWith( "hbm.xml" ) ) {
6363
return scanOptions.canDetectHibernateMappingFiles();
6464
}
6565

6666
// todo : should really do this case-insensitively
67-
if ( entry.getName().endsWith( "META-INF/orm.xml" ) ) {
67+
// use getNameWithinArchive, not getName -- ensure paths are normalized (Windows, etc.)
68+
if ( entry.getNameWithinArchive().endsWith( "META-INF/orm.xml" ) ) {
6869
if ( context.getPersistenceUnitDescriptor().getMappingFileNames().contains( "META-INF/orm.xml" ) ) {
6970
// if the user explicitly listed META-INF/orm.xml, only except the root one
7071
//

0 commit comments

Comments
 (0)