Ideally we should not need reflection on all generator classes, but only those that are actually used in the application.
Implementation ideas
We could try to detect at build time the value generators that will be used, but that might be fragile (especially since generator configuration in XML mapping is different, I believe).
We could try collecting the generator classes from the metadata during static init, and somehow pass those classes to a GraalVM "Feature", but I'm not sure that's even possible; so far I've only seen "build-time" reflection registration, even though the actual GraalVM calls happen in-JVM during static init.
Description
Follow-up on https://github.com/quarkusio/quarkus/pull/32433
Ideally we should not need reflection on all generator classes, but only those that are actually used in the application.
Implementation ideas
We could try to detect at build time the value generators that will be used, but that might be fragile (especially since generator configuration in XML mapping is different, I believe).
We could try collecting the generator classes from the metadata during static init, and somehow pass those classes to a GraalVM "Feature", but I'm not sure that's even possible; so far I've only seen "build-time" reflection registration, even though the actual GraalVM calls happen in-JVM during static init.
But ideally, we would improve Hibernate ORM so that it resolves constructors during static init, which might completely remove the need to enable reflection on generator classes. I've done something like that before, for JPA event listeners: https://github.com/hibernate/hibernate-orm/pull/4296/files#diff-c24aac287c39a1f113fe6f2b8f7f1e419673977a65c5a31eb02a5a371fa83844R25-R39