diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider.java index b3a104e578..c1fbecc1c8 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider.java @@ -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 public List getManagedClassNames() { return mergedClassesAndPackages; } + + @Override + public void pushClassTransformer(EnhancementContext enhancementContext) { + if (!NativeDetector.inNativeImage()) { + super.pushClassTransformer(enhancementContext); + } + } }, properties).build(); }