Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JOOQ vs Hibernate [closed]

When I chat to stackoverflowers on chat and read other tutorials about database with Java then they are guide me to use JOOQ instead of HIBERNATE.

I am totally aware about ORM with Hibernate and I prefer to use Hibernate and now aware almost about JOOQ by reading tutorials and implementation on small projects.

But I am confused what to choose and what is perfact for my dynamic web-applications which can be larger,medium or smaller, either Hibernate or JOOQ ?

BTW googled a lot but confused more and more...!!! Just Like : this,this and this.

Which one is best for different conditions and situations for developer.?

like image 294
Gopal00005 Avatar asked Apr 03 '15 07:04

Gopal00005


People also ask

Does jOOQ use hibernate?

Compared to other popular libraries like Hibernate, jOOQ takes a database-first or SQL-centric approach. With Hibernate, you usually start writing your Java classes first and then let Hibernate or a tool like Liquibase or Flyway generate corresponding database tables.

Is jOOQ an ORM?

jOOQ is an ORM-alternative that is relational model centric rather than domain model centric like most ORMs.

What is jOOQ used for?

jOOQ Object Oriented Querying, commonly known as jOOQ, is a light database-mapping software library in Java that implements the active record pattern. Its purpose is to be both relational and object oriented by providing a domain-specific language to construct queries from classes generated from a database schema.


1 Answers

While jOOQ and Hibernate compete for the same target audience, they do not solve the same problem at all. You've already linked this article in your question. The essence of it is simple:

  • Are you going to solve object graph persistence problems? Use an ORM (e.g. Hibernate)
  • Are you going to embed SQL into Java? Use SQL (e.g. jOOQ)

Of course, since both APIs cover accessing relational databases, they overlap in functionality to a certain extent. E.g. Hibernate also supports simple querying, while jOOQ also supports simple mapping.

While we should avoid delving into subjective discussions about whether object graph persistence or SQL is a better approach at interacting with your database, I think the above is a pretty objective answer to what API is better suited, once you've made the subjective decision.

AND: You can use both, e.g. ORM/Hibernate for CRUD, SQL/jOOQ for reporting.

(Disclaimer: I work for the company behind jOOQ, so this answer is biased)

like image 91
Lukas Eder Avatar answered Sep 21 '22 03:09

Lukas Eder