[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7146) Not possible to specify a SessionFactory-scoped interceptor

Wolfram Langer (JIRA) noreply at atlassian.com
Mon Mar 5 04:30:48 EST 2012


Not possible to specify a SessionFactory-scoped interceptor
-----------------------------------------------------------

                 Key: HHH-7146
                 URL: https://hibernate.onjira.com/browse/HHH-7146
             Project: Hibernate ORM
          Issue Type: Bug
          Components: core
    Affects Versions: 4.1.0
         Environment: Hibernate ORM 4.1.0 Final (2012-02-09)
Issue is independent of OS and DB system.
            Reporter: Wolfram Langer


With the new approach to instantiate a SessionFactory (i.e. ServiceRegistryBuilder -> ServicesRegistry -> MetadataSources -> Metadata -> SessionFactory) it is not possible to define a SessionFactory-scoped interceptor.

I checked the source code and it appears that an EmptyInterceptor is hard-coded.

SessionFactoryBuilderImpl:
buildSessionFactory(MetadataImplementor metadata) {
	this.metadata = metadata;
	options = new SessionFactoryOptionsImpl();
}

SessionFactory buildSessionFactory() {
	return new SessionFactoryImpl(metadata, options, null );
}

and instantiation of class SessionFactoryOptionsImpl has usage of the EmptyInterceptor hard-coded.
In contrast, the older code directly instantiates a SessionFactoryImpl an makes use of the interceptor that is specified in the Configuration.

My recommendations:

1.) Provide a point to specify the SessionFactory-scoped interceptor where approriate (at the ServiceRegistry?)
2.) Provide SessionFactory.setInterceptor(Interceptor) - unless this would be against the idea of configuring the SessionFactory by other means before instantiation.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list