Skip to content

Week 38

Malte Hviid-Magnussen edited this page Sep 20, 2019 · 10 revisions

Excercises for Week 38 - #5 Week - Flow 2 - 2019

Tuesday 17-09

  1. Exercise - Exercises JPA Relations

FOR REVIEWER - With regards to the questions in the exercise:

* I did these as Pair-Programming in the class on tuesday.  

// EVERYWHERE IT SAID "EXPLAIN" WE EXPLAINED IT TO EACH OTHER VERBALLY.

// EVERYWHERE WE DIDN'T UNDERSTAND SOMETHING, WE ASKED THE TEACHER AND HE EXPLAINED TO US. 

Wednesday 18-09

  1. Exercise - REST with JAX RS

Thursday 19-09

Continued Work on wednesday exercise and started looking at friday exercise. Work on the branch

Friday 20-09

  1. Exercise - Object Relational Mapping with JPA
  2. Exercise - ORM + JPQL

Questions:

  1. Explain the rationale behind the topic Object Relational Mapping and the Pros and Cons in using ORM
    • The idea behind it is that you have to get Programming Objects into SQL data tables.
  2. Explain the JPA strategy for handling Object Relational Mapping and important classes/annotations involved.
    • @Entity, @NativeQueries, @NativeQuery, @Id, @GeneratedValue, @ManyToOne, @OneToOne, etc.
    • We use Entity classes and EntityManager istead of regular JDBC.
    • We don't have to make our own datamappers anymore, which saves a huge amount of time.
  3. Outline some of the fundamental differences in Database handling using plain JDBC versus JPA
    • JPA has the EntityManager to handle things automatically for you. That frees up a lot of time to do other coding.
  4. Discuss how we usually have queried a relational database
    • We used to use JDBC and make SQL queries to the database directly.
  5. Discuss the methods we can use to query a JPA design and compare with what you explained above
    • Now we use EntityManager and query via entity-classes in java. It is much easier, because you use the java object names, intead of the SQL table names. It converts the SQL data into objects for you automatically and vice-versa.