Java Reference
In-Depth Information
Figure 8.1. Java uses JDBC and JPA, with Hibernate being the most common JPA provider. Most NoSQL
databases have a Java API that can be wrapped by Groovy; in this chapter GMongo is used to access MongoDB.
GORM is a Groovy DSL on top of Spring and Hibernate. Finally, the groovy.sql.Sql class makes it easy to
use raw SQL with a relational database.
With relational databases everything ultimately comes down to SQL, so I'll start there.
8.1. The Java approach, part 1: JDBC
JDBC is a set of classes and interfaces that provide a thin layer over raw SQL. That's a sig-
nificant engineering achievement, actually. Providing a unified API across virtually every
relational database is no trivial task, especially when each vendor implements significantly
different variations in SQL itself.
Still, if you already have the SQL worked out, the JDBC API has classes and methods to
pass it to the database and process the results.
 
 
Search WWH ::




Custom Search