I ended up with AOP solution :
@Aspect
@Component
public class EnableFilterAspect {
@AfterReturning(
pointcut="bean(entityManagerFactory) && execution(* createEntityManager(..))",
returning="retVal")
public void getSessionAfter(JoinPoint joinPoint, Object retVal) {
if (retVal != null && EntityManager.class.isInstance(retVal)) {
Session session = ((EntityManager) retVal).unwrap(Session.class);
session.enableFilter("myFilter").setParameter("myParameter", "myValue");
}
}
}