Hm, I tried and modified the source code, so that StatelessSessionImpl has an overloaded constructor that takes an interceptor. I also modified the session factory, so that it provides access to this constructor.
For my case it is working nicely: Adjusting the generated sql in onPrepareStatement(). This is to redirect inserts to an inherited table - which is postgres's way of partitioning. There are other ways to do this in the db directly (rules or triggers), but those ware way slower.
Can this be made part of Hibernate itself?
SFriedrich wrote:
Is there any earthly reason why a stateless session does not allow interceptors?
The StatelessSessionImpl constructur is hardcoded to use an empty interceptor.