Java JPA: How to use multiple DB-users?

I think about using JPA for a webapp. But every user should have its own DB-user/schema. Data of every single user should be private and hidden from all others.

As far I see I need to give JPA a single DB connection (including a user).

Is it possible to use different DB-users in one application?

1 answer

  • answered 2021-02-27 13:17 Amit

    Is this a real world scenario? What is the need of doing a logical separation of the users other than maintaining the privacy? There are other ways to hide the data. Encrypting the data at REST Vs in Flight can be an option too.