[hibernate-dev] Interceptors and dependency injection

Guillaume Smet guillaume.smet at gmail.com
Thu Dec 14 03:43:02 EST 2017


Hi all (and Steve especially as it seems you are working on the
subject right now),

You talking about CDI made me think of something we did at
$previousJob a long time ago.

I didn't quite follow what you did in 6 about CDI/Spring injection but
basically the requirement was to be able to create Spring managed
interceptors and to inject them in the PersistenceProvider.

At the time, we ended up with the following:
https://github.com/openwide-java/owsi-core-parent/blob/master/owsi-core/owsi-core-components/owsi-core-component-jpa/src/main/java/fr/openwide/core/jpa/hibernate/ejb/InterceptorAwareHibernatePersistenceProvider.java

But I think it would probably be nice if we could inject them directly.

Another thing we did which is not really related is creating a
ChainedInterceptor to be able to define several interceptors (the idea
was that we did want the ability to enable some interceptors at will
depending on what a given application required).

Just injecting the interceptors in a random order would probably not
do it as I think you will probably want to define them in an ordered
way.

Not sure it's useful but I thought I might as well talk about it now
that you are working on this feature.

Have a nice day.

-- 
Guillaume


More information about the hibernate-dev mailing list