Hello all,
i would like to use the Policies Feature in Jooq-Express,
and tested it in the Trial-Version.
It is working fine,
but i found some small things i want to ask about.
I have a "ConfigurationFactory" (in my quarkus-app) that should create the Jooq-Configuration only once (for performance-reasons).
I used to do it like this:
public class Database1ConfigurationFactory {
private Configuration configuration;
public Configuration getConfiguration() {
if (configuration == null) {
...
configuration = new DefaultConfiguration()
...
}
}
}
But now, when i also add the Policies for the Tenant Check, i need to pass the tenantId to the getConfiguration() function, so now the function suddendly needs to return unique Configuration instances, for each tenantId.
I fear that this will negatively affect my performance.
It would look like this:
public class Database1ConfigurationFactory {
private Configuration configuration;
public Configuration getConfiguration(Integer tenantId) {
...
configuration = new DefaultConfiguration()
configuration.set(new DefaultPolicyProvider()
.append(CUSTOMER, CUSTOMER.CUSTOMER_ID.eq(tenantId))
...
);
...
return configuration
}
}
am i implementing this correctly (as intended) or is there another way to apply the policies afterwards (maybe in a listened, like the executionlistener or something similar?)
greetings, Bernd