Sometimes, I just want to answer the question "where do I use this table"?
I'd like to be able to go to the place where that table is defined and do a
But my IDE (IntelliJ) will only find the references to the specific kind of
reference I'm using, JOOQ declares these "table references" in multiple
That I know of, there are at least three ways table (or views, etc.)
references are declared in JOOQ.
1) use the static constant in Tables class -
table = example.db.Tables.ACCOUNT
2) static constant in the concrete TableImpl subclass -
table = example.db.tables.Account
3) instantiate the concrete subclass -
table = new Account()
When I do "find usages" in IntelliJ, it only finds references to the one
specific way that my cursor happens to be on.
Does anyone know of a way where I can ask my IDE "what are all the places
the account table is used in the codebase".
I'm looking for a fast / easy way here that I can do this rapidly, many
times on all sorts of different objects - "grepping" or other text based
scripting is really not what I want.
Failing an IDE way (which I think might not exist) - is there a JOOQ
feature that can help with this?
For example, can I tell JOOQ not to generate the static constants, such
that using the Account constructor is the only way to refer to the table?
It would be less convenient - but that's fine, being able to easily know
all places in the code that refer to a table would be worth that price to
Failing existince of a JOOQ feature to help with this, it wouldn't be too
hard for me to remove the features during the code generation stage - but
would that even do the job though? Are the above three "reference types"
the only code-based ways to refer to DB objects, or other there other ways
I don't know about yet?
Yes, I understand this won't help me with views/functions, etc. that are
textually defined to use tables etc.
I'm aware I could put in place some kind of static analysis to enforce
usage of a single type of table reference. But I'm asking if I can use
JOOQ to eliminate the possibility of using different types.
I am using JOOQ 3.9.3 and Postgres.
My config settings are:
Postgres 9.6 server
JDBC Driver: org.postgresql:postgresql:42.1.4
The testcase found below will not work. It will say
Caused by: org.postgresql.util.PSQLException: ERROR: schema "POLYGENE"
does not exist
when trying to create the table.
Further looking, when the commit() is issued inside the
dsl.createSchema( "POLYGENE" ).execute();
the transaction state is in "IDLE" mode, and the commit is not executed.
The reason for that is that some ROLLBACK has been executed as part of a
close() that I don't understand. The commit() not executing is silently
ignored in driver, and nothing happens. Hence the failure on the creation
of the table.
and the test case works. Now, that could possibly be that there is an
autoCommit going on. I have not investigated that.
Swap those comments back to original, and the test fails (after manually
cleaning up the database).
Finally, swap the
TransactionProvider transactionProvider = new PolygeneTransactionProvider( new ThreadLocalTransactionProvider( connectionProvider, false ) );
// TransactionProvider transactionProvider = new ThreadLocalTransactionProvider( connectionProvider, false );
and the testcase also works. The wrapper couldn't be simpler, but why does
that cause a failure of this nature? Why is JOOQ checking the instance type
for behavior, instead of having proper methods for it?
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].