Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate org.jooq.Clause #7258

Closed
lukaseder opened this issue Mar 7, 2018 · 3 comments
Closed

Deprecate org.jooq.Clause #7258

lukaseder opened this issue Mar 7, 2018 · 3 comments

Comments

@lukaseder
Copy link
Member

lukaseder commented Mar 7, 2018

The VisitListener SPI is rather hard to implement correctly. One reason for this is that org.jooq.Clause is:

There has been a pending feature request to replace the Clause by actual QueryPart implementations: #3654, which is probably also not a good idea.

With this deprecation, we'll get feedback from users actually using the Clause, and we can better assess what to implement (if anything at all) in the future. The discussion will be open, and it might even include deprecating and removing the VisitListener SPI entirely. Discussion here: #7642

@matthewcachiaweavr
Copy link

Adding feedback as instructed in Clause.java's deprecation note.

Context:

  • MySQL 8
  • Micronaut 4 (jOOQ 3.19.7 comes bundled; version dictated by framework).
  • Blanket Row-level Locking across all schemas which have a specific column (owner).
  • A row is considered accessible if: owner is null or is equal to the subject accessing that piece of data.

The code snippet you provided in your article fits perfectly for my needs. At the same time I also agree that the visit listener with the current Clauses is really hard to work with.

Using an ExecutionListener(by tapping onto the context's query) proved much easier and works for the most part, except in certain "inline" situations where the query itself doesn't seem to be mutable. Take CTEs for example:

WITH
  cte1 AS (SELECT a, b FROM table1)
SELECT a, b FROM cte1

While I was able to access the inner query, I was unable to mutate it to become SELECT ... FROM table1 WHERE ownerId = ...). This forced me to revisit the VisitListener approach.

I would be happy to provide you the ExecutionListener approach, if you wish.

@lukaseder
Copy link
Member Author

Agh, I meant to update that article a long time ago. Row level security are a feature in jOOQ now, since jOOQ 3.19:
https://www.jooq.org/doc/latest/manual/sql-building/queryparts/policies/

@lukaseder
Copy link
Member Author

Ah, it's already mentioned in the middle, but not highlighted... I'll add it again at the top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants