Thanks for your message.

What you want to achieve is very similar to row-level security (RLS) or
multi-tenancy. jOOQ does not support this directly out of the box, but you
might want to look at this blog entry, which explains how to roll your own
using the VisitListener SPI:
https://blog.jooq.org/2015/06/17/implementing-client-side-row-level-security-with-jooq/
.

As a first step you may however want to check if your database provides any
RLS features out-of-the-box (e.g. as in Oracle) or what the recommendations
are for implementing this. This would then most likely be the better
alternative to the VisitListener approach.

Hope this helps,
Knut

On Tue, Aug 6, 2019 at 11:53 PM P R <[email protected]> wrote:

> To enable data isolation (and partitioning in future), our database has a
> customerId field in majority of the tables. So the expectation is that
> vast majority of the queries will have a condition like "customerId=..."
> and appropriate joins to the Customer table. But it is easy to make a
> mistake and forget to do this. Plus having each and every query in the code
> do this is introduces a lot of bloat given the joins involved. And hence
> the thinking is to have all query executions routed through a set of common
> API that wraps the underlying execution. It is in these common APIs, the
> query would be inspected prior to execution and accordingly tweaked for
> compliance.
>
>  E.g. Let's say I'm given a SelectQuery. I would look at the tables
> involved and accordingly add condition "someTable.customerId=..." to the
> query. Similarly one should be able to do this for Update or Delete queries.
>
> Now the question. With jOOQ, we can build queries. But after we build a
> query how do we get the constituent parts to enable the above? If this is
> not possible, any alternative suggestions other than trying to dissect the
> string representation of the query.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/3d2456e3-4f8e-4af4-bb38-f86db78bc6bf%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/3d2456e3-4f8e-4af4-bb38-f86db78bc6bf%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAFx%3DKgeQNj6tmmZJ5jTB2NWpzm-SzcFmdW8qh2RHQV21hvBsdA%40mail.gmail.com.

Reply via email to