Native Image with Hibernate - Missing Hibernate GraalVM Feature? #8071
-
Hi, I'm currently trying to get a rather mature Micronaut application with plenty of JPA entities to run as a native image. It seems like that the provided I therefore implemented my own GraalVM feature (code is still a prototype). Beside of projects specific stuff (NamingStrategies, CustomUserTypes and Embeddables, I had to define plenty of Hibernate specific classes since heavy reflection is involved. @AutomaticFeature
final class SalesServerFeature implements Feature {
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
// I had to register project specific NamingStrategies and custom Hibernate user types.
// I had to register project specific embeddables such as
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "ch.onstructive.salessystem.embeddables.OrganisationRef");
// Hibernate related stuff.
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.persister.entity.JoinedSubclassEntityPersister");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.persister.entity.SingleTableEntityPersister");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.persister.entity.UnionSubclassEntityPersister");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.persister.collection.OneToManyPersister");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.persister.collection.BasicCollectionPersister");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.sql.ordering.antlr.NodeSupport");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.sql.ordering.antlr.SortKey");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.sql.ordering.antlr.OrderingSpecification");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(
access, "org.hibernate.sql.ordering.antlr.SortSpecification");
AutomaticFeatureUtils.registerClassForRuntimeReflectionAndReflectiveInstantiation(
access, "org.hibernate.sql.ordering.antlr.OrderByFragment");
AutomaticFeatureUtils.registerConstructorsForRuntimeReflection(access, "antlr.CommonToken");
}
} My question is, wouldn't it make sense to put the Hibernate related code into the existing Micronaut Or am I doing something wrong? Furthermore I have noticed that the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
PRs welcome for the hibernate specific code to the existing HibernateFeature As for Flyway you could I guess load the environment within the flyway feature and try read the configuration location, would be a separate improvement. |
Beta Was this translation helpful? Give feedback.
PRs welcome for the hibernate specific code to the existing HibernateFeature
As for Flyway you could I guess load the environment within the flyway feature and try read the configuration location, would be a separate improvement.