[hibernate-dev] Testing Hibernate 5: injecting a Spring managed interceptor

Guillaume Smet guillaume.smet at gmail.com
Thu May 7 11:37:46 EDT 2015

Yup, populate(SessionFactoryBuilder, StandardServiceRegistry) was my
favorite spot too but it's currently private. Would you mind making it

Note that if we can do so without subclassing the said internal class, I'm
all ears :). This method was inspired by a blog post for 4.2 that I ported
to 4.3. It has the advantage of not being too intrusive.


On Thu, May 7, 2015 at 4:59 AM, Steve Ebersole <steve at hibernate.org> wrote:

> As outlined in
> http://docs.jboss.org/hibernate/orm/5.0/topical/html/bootstrap/LegacyBootstrapping.html#_migration, Configuration#setInterceptor
> calls now map to the SessionFactoryBuilder#applyInterceptor method.  So
> really we need to look at choices for how to influence the Interceptor on
> SessionFactoryBuilder.  I say choices because there are a few ways.  The
> most appropriate way I think in your case (given that you already
> questionable subclass an internal class ;) would be to just override
> EntityManagerFactoryBuilderImpl#populate(SessionFactoryBuilder,
> StandardServiceRegistry) to apply your Interceptor.
> On Wed, May 6, 2015 at 3:21 PM, Guillaume Smet <guillaume.smet at gmail.com>
> wrote:
>> Hi,
>> As I have cycles this week and next week, I thought I might as well do
>> some
>> QA on Hibernate 5.
>> I'm still in the process of porting our code to 5 atm and I have a pattern
>> we used before I can't find an elegant way to port on Hibernate 5: this
>> pattern is used to inject a Spring managed interceptor.
>> We override the persistence provider to inject the interceptor in the
>> Hibernate configuration:
>> https://gist.github.com/gsmet/e8d3003344938b1d327b
>> I studied the new code for quite some time and I couldn't find a way to
>> inject my interceptor in 5.
>> Note that it's a pretty common usage in the Spring managed world.
>> Thanks for any guidance.
>> --
>> Guillaume
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev

More information about the hibernate-dev mailing list