We checked that it is possible that some annotations are read after that the SessionFactory instance has been created. See [this pull request|https://github.com/hibernate/hibernate-orm/pull/3040].
Here is an instance of stack frames:
{code: none java } java.lang.reflect.Method.getAnnotation(Method.java) org.hibernate.service.internal.AbstractServiceRegistryImpl.applyInjections(AbstractServiceRegistryImpl.java:293) org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:283) org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243) org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214) org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:98) org.hibernate.internal.SessionFactoryImpl.getStatistics(SessionFactoryImpl.java:975) org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:245) {code}
For a classic Java stateless stateful application that is fine, but it would be an issue if we executed the same code with GraalVM, using for instance the Quarkus native generation.
For the new cloud native paradigm, code is supposed to be run in an immutable PAAS. It imposes a stateless approach: all the choices and initialization must me done before a pod/container runs. |
|