Pankaj Sharma
Pankaj Sharma

Reputation: 679

MyBatis run native Query

I want to do DB auditing, for that I need to set ee.username for the connection used by mybatis.

My question is how could I do that. I tried to look for many search results but couldn't find anything useful. I'm using postgressql and java.

Upvotes: 1

Views: 2502

Answers (1)

kenthewala
kenthewala

Reputation: 594

You may get it done by following method.

sqlSession.getConnection().prepareStatement("SET LOCAL ee.username = 'system'").execute();

Upvotes: 4

Related Questions