4 ms·
jOOQ can be used in a less-type-safe way. For example, `fetchMaps` [1] does more-or-less what you describe. However, I have found it worthwhile to learn to use
by oftenwrong 6y ago
jOOQ can be used in a less-type-safe way. For example, `fetchMaps` [1] does more-or-less what you describe.
However, I have found it worthwhile to learn to use the more advanced features you mention. Extending type safety to queries is incredibly useful. Consider cases when developers are making code and schema changes concurrently that overlap.
[1] https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/ResultQuery.html#fetchMaps() https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/Result...
- Scarbutt 6y agoSQL (at least in Postgres) is already type safe.
- oftenwrong 6y agojOOQ can effectively extend the type system of Java to the construction of ad-hoc queries by way of code generation. jOOQ generates Java classes that correspond to the database schema, which can be used in its query building DSL. For example, if I have a `timestamp with time zone` column in PostgreSQL, that is represented in the generated code. I will be prevented from inserting a Java `String` into that column - I will have to provide an `OffsetDateTime`. (This is how it would be in a typical configuration - it is flexible enough to do pretty much anything). Another example, let's say I reference some column in a query in one of my feature branches. Meanwhile, somebody has dropped that column on the master branch. When I rebase my feature branch onto master, my build will fail.