Be able to work with databases through an Object Relational Mapping Framework. The focus is on java/JPA, but the core concepts are widely applicable in almost all technologies "out there".
What/why is an ORM, install eclipselink+mysql dependencies, generate tables, generate classes (reverse JPA), the persistence unit, the Entity class, the EntityManager.
ORM. Only read the first section, to get an overall idea about ORM. This is a concept you will find in almost all modern technologies (Java, .Net, JavaScipt, PHP etc..)
Java Persistence (Wikibook). This should be your main reference for most of you JPA-related questions.
Important when you read the Wiki In most of the "technical" sections, you will find two examples. One, who specifies the mapping with annotations and another (the old way) who does it via XML-mappings We will ONLY use annotation based mappings, so you can ALWAYS skip the XML-parts. Don't be scared about "all" the links in the following. They are all just small sections in the same (wiki) book.
Read the following for day-1
- 3.3 What is JPA
- 3.7 Why use JPA or ORM?
- 4.0 Java Persistence/Persistence Products Skim only (we will be using EclipseLink)
- 5.0 Mapping Read down to the Access Type Section.
- 5.1, 5.2, 5.4, 5.6](https://en.wikibooks.org/wiki/Java_Persistence) Skim these sections, so you know where to come back, when you start with the exercises
- 6.2 Persisting (Inserting, Updating, Merging Read 1.1 -1.4 (skip the Advanced Section)
Relationships, cardinality, directionality and Inheritance (only red students)
From this chapter in the wikibook you should read:
Relationships. Make sure to follow and skim these links in this section :
- OneToOne
- ManyToOne
- OneToMany
- ManyToMany
- Java Persistence/Inheritance ONLY RED STUDENTS
JPQL-queries Read in this section of the wikibook
- 1.1 (skip 1.1.2)
- 1.2.1
- 1.4 parameters
- 1.5 Query Results
- 1.6 Common Queries Skim all sections to see what you can do. You will need this for the exercises.
- for your reference JPQL This is an extra ?? section in the wiki, which is kind of a complete referende to JPQL
The following tutorial from netbeans, as well as a couple videos Christian made, may help you through the JPA setup process if you forget it after the lecture. These are not useful learning resources. I recommend only using them if you forget how to setup the persistence unit, and do table/class generation with JPA.
- List of ALL JPA-annotations
- netbeans persistence unit tutorial
- Video JPA setup
- Video JPA database table -> entityclass
- Video JPA relationships
- Day-1
- Day-2, ( Day-2 RED ONLY )
- Day-3
- Friday