Skip to content

Commit

Permalink
Skip class transformer in PersistenceUnitInfoDescriptor for native im…
Browse files Browse the repository at this point in the history
…ages

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
  • Loading branch information
sdeleuze committed May 15, 2023
1 parent 806519f commit 085565a
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -22,6 +22,7 @@

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;
Expand Down Expand Up @@ -63,6 +64,13 @@ public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitI
public List<String> getManagedClassNames() {
return mergedClassesAndPackages;
}

@Override
public void pushClassTransformer(EnhancementContext enhancementContext) {
if (!NativeDetector.inNativeImage()) {
super.pushClassTransformer(enhancementContext);
}
}
}, properties).build();
}

Expand Down

0 comments on commit 085565a

Please sign in to comment.