I have an entity where I want to generate value like this.
like this
id tenant
1 1
2 1
3 1
1 2
2 2
3 2
1 3
2 3
3 3
Keep in mind that multiple instances are running of the same application. The primary key will be formed using "id" and "tenant" and for every tenant "id" will start from 1.
I thought of using sequences, but will it be thread safe when multiple instances of the same application are trying to create the id?