Can someone in a nutshell tell me the difference between these two objects and why one might be used over the other?
You should only ever reference Table. jOOQ's internals also use TableLike
jOOQ's DSL is full of little marker interfaces that are there only because the Java language lacks support for union types. For instance, in SQL syntax, a Table<?> (as in CREATE TABLE x ...) and a Select<?> (as in SELECT * FROM ...) are the same thing, when you put that thing in the FROM clause.
In an "ideal" Java language, the FROM clause would be declared as such:
interface SelectFromStep {
SelectWhereStep from(Table | Select tableReference);
}
Because that's not possible, and because overloading and generic type erasure is a great source of pain when (ab)using generics like jOOQ does, jOOQ has these marker interfaces. Like TableLike, which is the super type of both Table and Select.
It is thus important only as a method parameter type in the jOOQ DSL, not to you as a user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With