JPAApi - how to execute a "SET" statement at the beginning of every database session?

Well, this is probably more of a JPA question, but anyway…

In order to implement multitenancy, I have to do something like this at the beginning of every database session

SET SESSION "myapp.tenant" = 123

I tried to use an EmptyInterceptor, but I can’t figure out how to access the current JPAApi from there. Any ideas?

By the way I’m using Play Java 2.6.21

Hi.
You can access JPAApi everywhere in your classes by injecting it:
https://www.playframework.com/documentation/2.7.x/JavaJPA#Using-play.db.jpa.JPAApi