Repository: quarkusio/quarkus
Issue: Nullpointer at SchemaManagementIntegrator.disintegrate

### Describe the bug

I upgraded from version 2.1.2.Final to version 2.2.2.Final and now I got this error on Quarkus startup:

```
java.lang.NullPointerException
        at java.base/java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1111)
        at java.base/java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1102)
        at io.quarkus.hibernate.orm.runtime.schema.SchemaManagementIntegrator.disintegrate(SchemaManagementIntegrator.java:50)
        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:410)
        at io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.build(FastBootEntityManagerFactoryBuilder.java:71)
        at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.createEntityManagerFactory(FastBootHibernatePersistenceProvider.java:67)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
        at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:149)
        at io.quarkus.hibernate.orm.runtime.JPAConfig$1.run(JPAConfig.java:58)
        at java.base/java.lang.Thread.run(Thread.java:829)

```

I'm using 2 persistences units with postgres Database. Example:

```
quarkus.datasource."PU1".db-kind=postgresql
quarkus.datasource."PU1".username=<username>
quarkus.datasource."PU1".password=<password>
quarkus.datasource."PU1".jdbc.url=jdbc:postgresql://<ip>:<port>/<db_name>

# Persistence Unit PU1
quarkus.hibernate-orm."PU1".datasource=PU1
quarkus.hibernate-orm."PU1".database.default-schema=<schema>
quarkus.hibernate-orm."PU1".discriminator.ignore-explicit-for-joined=true
quarkus.hibernate-orm."PU1".dialect=<custom_dialect>
quarkus.hibernate-orm."PU1".fetch.max-depth=1
quarkus.hibernate-orm."PU1".packages=<package>


quarkus.datasource."PU2".db-kind=postgresql
quarkus.datasource."PU2".username=<username>
quarkus.datasource."PU2".password=<password>
quarkus.datasource."PU2".jdbc.url=jdbc:postgresql://<ip>:<port>/<db_name>

# Persistence Unit PU2
quarkus.hibernate-orm."PU2".datasource=PU2
quarkus.hibernate-orm."PU2".database.default-schema=<schema>
quarkus.hibernate-orm."PU2".discriminator.ignore-explicit-for-joined=true
quarkus.hibernate-orm."PU2".dialect=<custom_dialect>
quarkus.hibernate-orm."PU2".fetch.max-depth=1
quarkus.hibernate-orm."PU2".packages=<package>
```

I'm using cache. Example:

```
quarkus.hibernate-orm."PU1".cache."<name>".expiration.max-idle=300
quarkus.hibernate-orm."PU1".cache."<name>".memory.object-count=250000
quarkus.hibernate-orm."PU2".cache."<name>".expiration.max-idle=300
quarkus.hibernate-orm."PU2".cache."<name>".memory.object-count=250000
```
Almost all objects attributes on method 'SchemaManagementIntegrator.disintegrate' are empty or with their default values :
```
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
        metadataMap.remove(nameCache.get(sessionFactory));
        nameCache.remove(sessionFactory);
    }
```


### Expected behavior

_No response_

### Actual behavior

_No response_

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

openjdk version "11.0.11"

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.2.2.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Apache Maven 3.8.1 

### Additional information

_No response_

Changed files:
extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java

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 7894da4a866..828e5dc3d13 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() {