Custom sql at the begin of every transaction


I use Flowable within a spring boot application. Can I use some existing hooks to execute app-specific SQL statements at the begin of every transaction?

Background: In PostgreSQL, you can change the database user per transaction, using the command ‘SET LOCAL ROLE’. I want to change user because I use PostgreSQL-provided access control features to restrict users’ access to model classes.

Thank you very much,

It’s quite low level, but one way could be to plug in a custom DbSqlSessionFactory (, that does something on the connection in the #openSession method. Haven’t tried it, but in theory that should do trick.