added a comment - - edited
Bernd: But the schema prefix should be added by the engine when executing the query in my opinion. Otherwise I see the Multi-Tenancy support somehow half baked, as a lot of code can be used independent of what engine/tenant you use, un some code not. And table prefix is configuration of the environment, this should not make its way into the Java code…
Daniel: Bernd, I don't agree. I have a bad feeling about "touching" the user's query. If I provide a custom query as a user I don't expect it to be manipulated behind the scenes.
And, it might also not be a 100% trivial thing to do. What do you do if the user joins custom domain tables? Do you prefix those as well?
What do you do if the user does not read the javadoc and provides the prefix himself? Can you always recognize this? Ignore it or throw an exception...? This could go on. I am sure that there are some more corner cases that are not trivial to handle.
But there might be different solutions to your problem. You could make the prefix available via the management service. Or you could add a
Method which does your replacements. This would make the user more aware of the magic you perform.
Bernd: For me the important part is, that you can work with the table prefixes without manually coding it, so a two-step approach would be OK for me.