diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java index 7894da4a86630..828e5dc3d134a 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java @@ -47,8 +47,10 @@ public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactor @Override public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { - metadataMap.remove(nameCache.get(sessionFactory)); - nameCache.remove(sessionFactory); + final String name = nameCache.remove(sessionFactory); + if (name != null) { + metadataMap.remove(name); + } } public static void clearDsMap() {