extracts from intro to db - jdbc - jpa –...

75
[email protected] Extracts from Intro to Db - Jdbc - JPA – SpringData This document: http://arnaud-nauwynck.github.io/docs/Intro- CodeExtract-DB-Jdbc-JPA-SpringData.pdf

Upload: others

Post on 10-Jan-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

[email protected]

Extracts fromIntro to Db - Jdbc - JPA – SpringData

This document:http://arnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc-JPA-SpringData.pdf

Page 2: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

http://arnaud-nauwynck.github.io/docs/ Intro-DB-Jdbc-JPA-SpringData.pdf

SOURCE Document :

~ 150 pages : lesson to read

THIS Document

~ 80 pages : slides to present

Page 3: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

SQL Client Driver(1) < DataBase< B-Tree File

< JDBC API(2) < Driver Impl.

Spring JDBC

< JPA API - JPQL(3) < Hibernate/EclipseLink

Spring JPAQueryDsl

(4) < Spring Data

Page 4: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Oracle Sample DataBasehttps://github.com/oracle/db-sample-schemas/

human_resources/hr_cre.sql

Page 5: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

UML Employee - Department

Employee

0..1 manager

Department0..1 dept* employees

0..1 deptManager

Page 6: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Example using PGAdmin3

Page 7: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Detailed CRUD

INSERT into <Table..> (col1, col2, …)VALUES (?0, ?1, 123, ..)

SELECT * from <Table..> where <expr..>

UPDATE col1=value1, col2=… from <Table..> where <expr..>

DELETE from <Table..>where <expr..>

CRUD =

Create

Read

Update

Delete

Page 8: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Emp-Dept CRUD Sample

Page 9: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

SQL Exerciseshttp://www.w3resource.com/sql-exercises/sql-subqueries-

exercises.php

Page 10: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

B-Tree = Balanced-Tree (not only Binary Tree)

Page 11: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

B-Tree on (Col1,Col2...) = INDEX

PK INDEX : col (ID)

INDEX2 : (Col2,Col3,ID)

INDEX3 : (Col3,Col2,Col6)

Insert ROW = (ACID : Atomic) Insert Data + Insert Index1 + Insert Index2 + ….

Page 12: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Select .. where ID = ?

Execution Plan

Step 1: Index Lookup (Unique) by ID Log(N) logical reads

=> get “rowId” (=address)

Step 2: table lookup by RowId (=O(1)) => get other columns

Page 13: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Applicable Index(es) ?for “.. where Col2=? And Col5=?”

PK INDEX : col (ID)

INDEX (Col2,Col6,Col5)

INDEX (Col2,Col5,Col6)

INDEX (Col5,Col2,Col7)

INDEX (Col1,Col2,Col5)

Applicable =Allow Lexicographical Top->Down Search

Page 14: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Query Execution Engine

“Select ..from ..where .. col1='val1'and col2=123“

Execute Query

Result : Tabular Data Format = “ResultSet”

Page 15: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Huge Result .. Server-Side “Cursor”

Result = Partial Data + Cursor (= handle of server-side Partial Data+ Iterator)

Begin “Execute” Query

Fetch next page

Fetch next page

Fetch next page

CLOSE CURSOR !!

Page 16: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

SoftParse – HardParse … PrepareQuery + BindVariable

“Select ..from ..where .. col1=?0and col2=?1“

BindVariable: set(0, “val1”) set(1, 1234)

First Seen ? HARD Parse

Already Seen ? SOFT Parse= create Cursor

Compute Execution Plan

Put in Cache

Page 17: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Explain Execution Plan

Page 18: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Query / Prepared Query ExecutionSelect ..from ..where .. col1=?0and col2=?1

Prepare (SQL)

PreparedStatement

ExecuteQuery

ResultSet (page1)

Fetch next page

BindVariable: set(0, “val1”) set(1, 1234)

Next rowget col1, get col2 …next row...

Page 19: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Spring JDBC

Spring JPAQueryDsl

Page 20: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

import java.sql.*;

DataSource Connection PreparedStatement ResultSet

Page 21: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Sample Jdbc (Test with Rollback)

Page 22: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Refactored (1/2)

Page 23: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Refactored (2/2)“Template” + Callback

Common TemplateFramework

.. similar to Spring Template

Code to run with Cx+ rollback

Page 24: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Data Transfer Object for CRUD

Page 25: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

CRUD 1 / 4 : SELECT

Page 26: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Jdbc is As Verbose as Easy ...

Is it DRY ?

D don'tR repeat Y yourself

Page 27: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

CRUD 2 / 4 : INSERT

Page 28: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

CRUD 3 / 4 : UPDATE (All columns)

Page 29: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

UPDATE with Versioning

Page 30: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

CRUD 4 / 4 : DELETE

Page 31: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

import java.sql.*; (full)

DataSource

Driver

Connection Statement ResultSet

PreparedStatement

CallableStatement

XADataSource XAConnection

XAResource

DatabaseMetaData ResultSetMetaDataParameterMetaData

Page 32: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

H2 DataSource HelloWorld

Page 33: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Postgresql HelloWorld

Page 34: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Spring JDBC

Spring JPAQueryDsl

Page 35: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Spring-Jdbc Database App

Page 36: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Springboot config/application.yml

Page 37: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Springboot JDBC… “JUST work”

Page 38: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Springboot Jdbc main()

Pooled DataSource injected

Start Spring+ inject DataSource

Page 39: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Springboot JUnit

DataSource in injectedPooled DataSource injected

Start Spring+ inject DataSource

Page 40: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

(Reminder) try-finally .close()

Using explicit Transaction+ commit/rollback

Using try-close

Rule for ALL Resources : If You Open It => You Close It

Page 41: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

using Template Spring-Jdbc

Page 42: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

PooledConnection + Transaction= Thread-Locked : reuse

XA ..

XA commit/rollback=> connection commit/rollbackTHEN repool

Thread-12

Conn

Page 43: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Springboot built-in supports JTA @Transactional

Page 44: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Spring JDBC

Spring JPAQueryDsl

Page 45: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

JPA (with springboot data)

Page 46: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

EntityManager

Page 47: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

What is an “Entity” ?

A class with @Entity

And an @Id

Page 48: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Sufficient @Annotations to know?

@Entity

@Id@GeneratedValue@SequenceGenerator@Version

@ManyToOne

@OneToManyFor relationshipsFK (*) → (1) PKPK (1) ← (*) FK

Base

@Inheritance

@DiscriminatorColumn

@JoinTable@JoinColumn

@Table@ColumnCustom

Sub-Classes

Page 49: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Why putting @Column & @Table ?

Page 50: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

@Id with Sequence Generator

SQL:CREATE SEQUENCE employees_seq INCREMENT BY 10;

Detailed JPA:

Page 51: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

@Version ?

whenever overwriting modified value without reading =>

version=1

(1) (2):Get data version:1

(3):Mofify + Save (on version 1)OK => increment version=2

Wait...

(4):Mofify + Save (on version 1?)=> OptimisticLockException .. version=2 !

(5):REDO fetch + update

(6):Save (on version=2)OK

Page 52: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

@Entity Employee-Department

Database table “EMPLOYEE” id (PK), version, first_name, last_name, …. department_id (FK department.id) manager_id (FK employee.id)

Database table “DEPARTMENT”id (PK), version, name, department_manager_id (FK employee.id)

Page 53: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

For real with @Column ...

Page 54: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

FindById with JPA

Page 55: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

CRUD with JPA

Page 56: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Dynamic Query( java.persistence.CriteriaBuilder )

Page 57: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Dynamic Queryusing Bind-Variables

Page 58: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Dynamic Query … String type checking?

Which one is correct??? Discover it by Exception on PROD !

cb.get(“addr”) // column name in Databasecb.get(“address”) // field name in javacb.get(“adress”) // with a Typocb.get(“city_id”).get(“name”) // after refactoring db schema

Page 59: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Generated *_ class MetaModel + Compile Type Check

Generate

Page 60: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

DynamicCriteria using MetaModel

Page 61: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Search Parameters in Criteria class(also called “Specification”)

Cascading Setters with “return this” for Fluent API

Page 62: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Spring JDBC

Spring JPAQueryDsl

springboot data

Page 63: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

QueryDsl++More Fluent than JPA

Page 64: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Spring JDBC

Spring JPAQueryDsl

springboot data

Page 65: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and
Page 66: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Repository

Page 67: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Sample Codeusing springboot-data Repository

Page 68: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Springboot hibernate… “JUST work”

CRUD … select * from EMPLOYEE where …

insert into EMPLOYEE (..) values (..)

Page 69: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

When/How/Where are my “create Table ()” ???

Tables are created/updated at startup

Detected H2 Database SQL langage

Also create PK/FK indexes

Page 70: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

extends JpaRepository

Page 71: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Small + Custom + Almost Complete(see also next for QueryDsl)

By naming convention .. Equivalent to:“Select * from EMPLOYEE where email=?”

Extends JpaRepositorybuilt-in CRUD …

findAll, by Page, save, delete...(no update, use Setters)

Page 72: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

QueryDsl + Spring-Data

Page 73: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

AngularJS + Springboot

In Jhipster … you have 100% springboot on server-side… with Code GeneratorAnd also Hipe code on client-side : Html / Css + AngularJS + ..

Page 74: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Java is HipeMake Jar nor WAR – NO PHP

NO NodeJS on server

20 years of JavaJust The Beginning

Its HIPE ...because of springboot & open-source & java community

Page 75: Extracts from Intro to Db - Jdbc - JPA – SpringDataarnaud-nauwynck.github.io/docs/Intro-CodeExtract-DB-Jdbc...Query / Prepared Query Execution Select.. from.. where .. col1=?0 and

Conclusion

This document:http://arnaud-nauwynck.github.io/docs/Intro-CodeExtract-Db-Jdbc-JPA-SpringData.pdf