Slides and demo code for my talk at DOAG2016
JavaScript CSS HTML Java Shell Batchfile
Latest commit fac4809 Jan 10, 2017 @michael-simons Fix api path
Permalink
Failed to load latest commit information.
.mvn/wrapper
slides
src
.gitignore
LICENSE.txt
README.md
mvnw
mvnw.cmd
nbactions.xml
pom.xml

README.md

Database centric applications with Spring Boot and jOOQ

Important: The commits and commit messages have been written very carefully to guide you through reading this project and understanding the talk. Please take your time to study them if you don't understand something.

Slides

The slides are inside this repository and also on Speakerdeck:

Datenbankzentrische Anwendungen mit Spring Boot und jOOQ

Series of blog posts

I have created a series of blog posts around this project, make sure to check them out:

  1. Database centric applications with Spring Boot and jOOQ
  2. Create a Oracle Database Docker container for your Spring Boot + jOOQ application
  3. Take control of your development databases evolution
  4. An HTTP api for analytic queries
  5. Oracle JET: JavaScript components for mere mortals?

Those posts cover the talk and the project in great detail. Please provide feedback and a star, if you like them.

Talk at DOAG 2016

Note: The talk and the slides are in German as DOAG con is a German conference, the demo, the readme and other artifacts inside this repo are in English in hope they are useful to a broader audience.

This repository contains the This repository contains the talk, including my notes and the complete demo, I've created for DOAG Konferenz + Ausstellung in Nürnberg.

Here's the link to the german manuscript: Datenbankzentrische Anwendungen mit Spring Boot und jOOQ.

The basic idea of this demo is to create "cloud native" app based on Spring Boot and then using jOOQ as "database first", SQL-centric approach to your database.

Functional wise the application deals with a simple database model storing the names, artists, genres and albums of tracks I listened to the last years. Those data in full comes from my daily foto project Daily Fratze that I've been running this year for more than 12 years.

The application demonstrates the value of jOOQ when it comes to analysis of data, an area for which ORMs like hibernate weren't designed (see comment by Gavin King on "What ORMs have taught me: just learn SQL". If you just deal with simple inserts, updates and deletes during OLTP, you're mostly fine using ORMs like JPA, even problems like the n+1 query problems are known and often solved.

But if you want to use modern sql and the index, for example powerful, analytic functions or have to deal with a database model that is a less than optimal fit for an ORM, than jOOQ will help you.

Sample requests

Part of the application is in actual use (the schema and some of the queries) at Daily Fratze. You can implement your own scrobble application. This version supports the following requests for now

## Get all artists
curl -X "GET" "http://127.0.0.1:8080/api/artists"
## Get top n albums by some artists
curl -X "GET" "http://127.0.0.1:8080/api/artists/54,86/topNAlbums"
## Get top n tracks by some artists Duplicate
curl -X "GET" "http://127.0.0.1:8080/api/artists/54,86/topNTracks"
## Get cumulative plays by some artists
curl -X "GET" "http://127.0.0.1:8080/api/artists/54,86/cumulativePlays"
## Get charts for a month
curl -X "GET" "http://127.0.0.1:8080/api/charts/2016/5?n=40"

Creating and running the demo database

As DOAG Konferenz is an Oracle database centric conference, I used Oracle throughout the demo and prepared some docker scripts to get you up and running quickly.

  1. Go to docker.com and install docker on your machine
  2. Download Oracle Database 12c Release 1 Enterprise Edition for Linux
  3. Go to Oracles docker images repository, download the OracleDatabase scripts and follow the instructions. Remember to add the two files from step 2 to "dockerfiles/12.1.0.2". I used the following command: ./buildDockerImage.sh -v 12.1.0.2 -e
  4. Then, inside this repository, create a running container of this image with mvn docker:start. The first start will take a while. The reason behind this is that the Oracle database files are created during the first start and not during image creation. The files are storted inside ${project.basedir}/var. There's a timeout of 30 minutes. You may have to change this if you are on a slower machine
  5. The container exposes the following ports to localhost: 1521, 5500 and 5501. The first for SQL*Plus, the later ones for the Oracle Enterprise Manager

You can access the Enterprise manager express for the root container at https://localhost:5500/em and the container ORCLPDB1 at https://localhost:5501/em.

Use SQL*Plus to interact with the database. The admin password is a password generated during first startup and you can find it inside the container logs. The doag2016 account can be used with sqlplus doag2016/doag2016@//localhost:1521/ORCLPDB1, the password is doag2016, too.

Configuring the Oracle Maven Repository

This demo uses the Oracle JDBC driver from the official Oracle Maven Repository under those coordinates:

<dependency>
    <groupId>com.oracle.jdbc</groupId>
    <artifactId>ojdbc7</artifactId>
</dependency>
<dependency>
    <groupId>com.oracle.jdbc</groupId>
    <artifactId>orai18n</artifactId>
</dependency>

Please follow those instructions from Oracle to make this work for your Maven installation.

Installing jOOQ Pro

This demo uses an Oracle Enterprise Edition database, so it needs a jOOQ Professional edition to run. You can get a free, 30 days trial edition here: jOOQ Download.

Ressourcen

License

Creative Commons Lizenzvertrag
"Database centric applications with Spring Boot and jOOQ" von Michael J. Simons ist lizenziert unter einer Creative Commons Namensnennung - Nicht-kommerziell - Weitergabe unter gleichen Bedingungen 4.0 International Lizenz.

Imagerights

  • "Relentless Persistence": © Curtis Lassam, Cube Drone
  • "Electronic data": © iStockphoto.com/shironosov
  • "Magnet und Blanko-Kühlschrank": © iStockphoto.com/andy0man
  • "Oracle Databases": Public Domain
  • "Young men with tablet": © iStockphoto.com/boggy22