3 ms·
In Java there's another popular alternative to ORM/Hibernate, JOOQ (https://www.jooq.org/ https://www.jooq.org/). Which is basically type-safe SQL. The idea is
by 62951413 5y ago
In Java there's another popular alternative to ORM/Hibernate, JOOQ (https://www.jooq.org/ https://www.jooq.org/). Which is basically type-safe SQL.
The idea is to
* start from an existing relational schema
* run a CLI tool to generate Java code that represents all the tables/fields,
* write queries in the application code that look like ".select().from(AUTHOR).join(BOOK).on(BOOK.AUTHOR_ID.eq(AUTHOR.ID)).fetch();"
So you don't need to mess up with strings anymore or learn any DSLs. Your queries look exactly like regular SQL and so are very readable. This approach is well aligned with schema migrations represented as SQL scripts too. But not everyone is comfortable with using code generation.
- bborud 5y agoSQL is actually pretty okay for writing SQL. I was never in love with this rather roundabout way of doing things since it didn’t solve problems I was actually having.