You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Spring 5.0.6 and a custom LocalSessionFactoryBean for Hibernate 5, I'd like to register a Hibernate integrator progammatically. This needs to be done via BootstrapServiceRegistryBuilder#applyIntegrator.
In the LocalSessionFactory bean, BootstrapServiceRegistryBuilder is only aquired in getMetadataSources():
This means, in order to simply apply an integrator, I have to override getMetadataSources to apply additional stuff to the BootstrapServiceRegistryBuilder. As private fields are used (metadataSourcesAccessed, metadataSources), ugly code duplication needs to be done.
So IMHO it would be great if the builder could easily be accessed in another way.
You could externally build the MetadataSources instance through a custom BootstrapServiceRegistryBuilder and set it through LocalSessionFactoryBean.setMetadataSources, getting your Integrator applied that way. You would do it the same way on a plain LocalSessionFactoryBuilder in a purely programmatic style, whereas it isn't quite as natural on LocalSessionFactoryBean which is meant for a more declarative style.
That said, this is not really obvious. It may make sense to provide a dedicated setIntegrators method on LocalSessionFactoryBean since this is by far the main purpose for customizing the BootstrapServiceRegistryBuilder. I'd rather keep the builder itself internal, not exposing other options or API dependencies through it.
Uh oh!
There was an error while loading. Please reload this page.
Niko Wittenbeck opened SPR-16828 and commented
Hi there,
using Spring 5.0.6 and a custom LocalSessionFactoryBean for Hibernate 5, I'd like to register a Hibernate integrator progammatically. This needs to be done via BootstrapServiceRegistryBuilder#applyIntegrator.
In the LocalSessionFactory bean, BootstrapServiceRegistryBuilder is only aquired in getMetadataSources():
This means, in order to simply apply an integrator, I have to override getMetadataSources to apply additional stuff to the BootstrapServiceRegistryBuilder. As private fields are used (metadataSourcesAccessed, metadataSources), ugly code duplication needs to be done.
So IMHO it would be great if the builder could easily be accessed in another way.
Affects: 5.0.6
Issue Links:
Referenced from: commits b6d9556
The text was updated successfully, but these errors were encountered: