Browse Source

Skip class transformer in PersistenceUnitInfoDescriptor for native images

In order to restore native support with Hibernate 6.2, this
change updates the PersistenceUnitInfoDescriptor instance
created by SpringHibernateJpaPersistenceProvider in order to
skip the class transformer for native images.

Closes gh-30492
pull/30619/head
Sébastien Deleuze 2 years ago
parent
commit
085565a771
  1. 8
      spring-orm/src/main/java/org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider.java

8
spring-orm/src/main/java/org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider.java vendored

@ -22,6 +22,7 @@ import java.util.Map; @@ -22,6 +22,7 @@ import java.util.Map;
import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.spi.PersistenceUnitInfo;
import org.hibernate.bytecode.enhance.spi.EnhancementContext;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.jpa.HibernatePersistenceProvider;
@ -63,6 +64,13 @@ class SpringHibernateJpaPersistenceProvider extends HibernatePersistenceProvider @@ -63,6 +64,13 @@ class SpringHibernateJpaPersistenceProvider extends HibernatePersistenceProvider
public List<String> getManagedClassNames() {
return mergedClassesAndPackages;
}
@Override
public void pushClassTransformer(EnhancementContext enhancementContext) {
if (!NativeDetector.inNativeImage()) {
super.pushClassTransformer(enhancementContext);
}
}
}, properties).build();
}

Loading…
Cancel
Save