Skip to content

Apply Hibernate Integrator through LocalSessionFactoryBean [SPR-16828] #21368

Closed
@spring-projects-issues

Description

@spring-projects-issues

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():

public MetadataSources getMetadataSources() {
(...)
 BootstrapServiceRegistryBuilder builder = new BootstrapServiceRegistryBuilder();
(...)
 this.metadataSources = new MetadataSources(builder.build());
 }
 return this.metadataSources;
 }

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

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions