Sponsored Links
-->

Tuesday, October 2, 2018

jOOQ: The easiest way to write SQL in Java
src: www.jooq.org

Java 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.


Video Java Object Oriented Querying



Paradigm

jOOQ claims that SQL should come first in any database integration. Thus, it does not introduce a new textual query language, but rather allows for constructing plain SQL from jOOQ objects and code generated from a database schema. jOOQ uses JDBC to call the underlying SQL queries.

While it provides abstraction on top of JDBC, jOOQ does not have as much functionality and complexity as standard object-relational mapping libraries such as Hibernate and JPA.

jOOQ's closeness to SQL has advantages over typical object-relational mapping libraries. SQL has many features that cannot be used in an object oriented programming paradigm; this set of differences is referred to as the object-relational impedance mismatch. By being close to SQL, jOOQ helps to prevent syntax errors and type mapping problems. Also, variable binding is taken care of. It is also possible in jOOQ to create very complex queries, that involve aliasing, unions, nested selects and complex joins. jOOQ also supports database-specific features, such as UDTs, enum types, stored procedures and native functions.


Maps Java Object Oriented Querying



Example

A nested query selecting from an aliased table

And its equivalent in jOOQ DSL:

Or more simply, using code generation from the database metadata to generate constants:


Carcassonne Expert Game1 Carcassonne Java Jess Expert Game ...
src: images.slideplayer.com


See also

  • List of object-relational mapping software
  • SQL/OLB

Java 8 for constructing JPA criteria queries - Dreamix blog
src: dreamix.eu


External links

  • jOOQ Home
  • JSR-341
  • JaQu
  • Linq4j
  • Quaere
  • QueryDSL

Source of article : Wikipedia