I attached a testcase showing what I would like to achieve. By the way, please also take a look at the FunctionIntegrator. I tried various different methods to integrate my custom function with the session factory but only a reflection hack worked..