From e01ea70d40f32c5774128561c50bba1349d263a5 Mon Sep 17 00:00:00 2001 From: Arthur Dambrine Date: Mon, 31 Oct 2022 09:26:18 +0100 Subject: [PATCH] session 5 --- readme.md | 6 +++- unit2_building_spring_boot_webapp.md | 42 +++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index eeb2db2..a806ed5 100644 --- a/readme.md +++ b/readme.md @@ -13,4 +13,8 @@ Session 1 - 26/10/2022 - stoped reading [@here](https://sparkers.udemy.com/cours Session 2 - 27/10/2022 - finished unit 1 -Session 3 - 28/10/2022 - ended [@here](https://sparkers.udemy.com/course/spring-framework-5-beginner-to-guru/learn/practice/1161612#overview) \ No newline at end of file +Session 3 - 28/10/2022 - spring initializr, open a spring project in IntelliJ and github workflow + +Session 4 - 30/10/2022 - JPA entities + +Session 5 - 31/10/2022 - Equality in hibernate and spring data repositories \ No newline at end of file diff --git a/unit2_building_spring_boot_webapp.md b/unit2_building_spring_boot_webapp.md index 8e1a175..7675be5 100644 --- a/unit2_building_spring_boot_webapp.md +++ b/unit2_building_spring_boot_webapp.md @@ -46,6 +46,9 @@ From the currated dependancies you can omit the version when you add them to you Session 3 - 28/10/2022 - ended here
+ + + ## Github Workflow [Starts from here](https://sparkers.udemy.com/course/spring-framework-5-beginner-to-guru/learn/lecture/17789252#overview) Github workflow. @@ -137,5 +140,42 @@ Session 4 - 30/10/2022 : ended here
+### Equality in Hibernate + +[Starts from here](https://sparkers.udemy.com/course/spring-framework-5-beginner-to-guru/learn/lecture/17792132#notes) Equality in hibernate + +Leakage necessary - hibernates uses equals and hashcode methods. + +#### Equals and HashCode + +`@Override` the methods to have a logic around the id property. + +**Tips**: use `alt+insert` equals() and hashCode() metods for the `id` field + + + +#### ToString + +**Tips**: `alt+insert` implement toString( ) + + + +### Spring Data Repositories + +Spring Data with JPA helps us implement repositories. + +Prevents us to write all this "ceremonial code" that JDBC needs. + +Create a new package `repositories` + +For each domain object create an `interface`. + +Example: `AuthorRepository.java` + +```java +public interface AuthorRepository extends CrudRepository { } +``` + + -***Session 5 - 31/10/2022 : [Starts from here](https://sparkers.udemy.com/course/spring-framework-5-beginner-to-guru/learn/lecture/17792132#notes) Equality in hibernate*** \ No newline at end of file +Session 5 - 31/10/2022 : ended here \ No newline at end of file