From 149e0caf9a2d36b0dfd9254b37c62c2bb73d2f0c Mon Sep 17 00:00:00 2001 From: "github-classroom[bot]" <66690702+github-classroom[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 09:40:48 +0000 Subject: [PATCH 1/4] add deadline --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5150e50f..05def9a9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/_uV8Mn8f) # 📘 Projektarbete: JPA + Hibernate med GitHub-flöde Projektet genomförs som antingen en Java CLI-applikation eller med hjälp av JavaFX om ni vill ha ett grafiskt gränssnitt. From 946936da744aa0bb734394e0c36839ee241609b3 Mon Sep 17 00:00:00 2001 From: EraiicPhu Date: Tue, 16 Dec 2025 10:45:21 +0100 Subject: [PATCH 2/4] Test av implementation av docker + env --- .gitignore | 1 + Dockerfile | 6 +++ dfg | 42 +++++++++++++++++++++ docker-compose.yaml | 16 ++++++++ src/main/resources/META-INF/persistence.xml | 22 +++++++++++ 5 files changed, 87 insertions(+) create mode 100644 Dockerfile create mode 100644 dfg create mode 100644 docker-compose.yaml create mode 100644 src/main/resources/META-INF/persistence.xml diff --git a/.gitignore b/.gitignore index 6ac465db..244268f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ target/ /.idea/ +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..2213772e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM eclipse-temurin:21-jdk + +COPY src/main/java/org/example/App.java /App.java + +ENTRYPOINT ["java", "/App.java"] + diff --git a/dfg b/dfg new file mode 100644 index 00000000..6dac856d --- /dev/null +++ b/dfg @@ -0,0 +1,42 @@ +commit 149e0caf9a2d36b0dfd9254b37c62c2bb73d2f0c (HEAD -> main, origin/main, origin/HEAD) +Author: github-classroom[bot] <66690702+github-classroom[bot]@users.noreply.github.com> +Date: Mon Dec 15 09:40:48 2025 +0000 + + add deadline + +commit 879440803daa45b536e2ea5f3ec269d1be62bf04 (upstream/main, upstream/HEAD) +Author: Martin Blomberg +Date: Sun Dec 14 16:07:37 2025 +0100 + + Setup for JPA application + +commit 539e1a559ab7607b40651315e45ef50074c51b8c +Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> +Date: Sun Dec 14 12:52:36 2025 +0000 + + Bump org.mockito:mockito-junit-jupiter in the maven-deps group (#1) + + Bumps the maven-deps group with 1 update: [org.mockito:mockito-junit-jupiter](https://github.com/mockito/mockito). + + + Updates `org.mockito:mockito-junit-jupiter` from 5.20.0 to 5.21.0 + - [Release notes](https://github.com/mockito/mockito/releases) + - [Commits](https://github.com/mockito/mockito/compare/v5.20.0...v5.21.0) + + --- + updated-dependencies: + - dependency-name: org.mockito:mockito-junit-jupiter + dependency-version: 5.21.0 + dependency-type: direct:development + update-type: version-update:semver-minor + dependency-group: maven-deps + ... + + Signed-off-by: dependabot[bot] + Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> + +commit c9a2be0c3d4286e6322bb017f66aa77bbaaa5a00 +Author: github-classroom[bot] <66690702+github-classroom[bot]@users.noreply.github.com> +Date: Sun Dec 14 12:51:33 2025 +0000 + + Initial commit diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..18509cce --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,16 @@ +services: + mysql: + image: mysql:9.5.0 + container_name: mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: rootpassword + MYSQL_DATABASE: app_db + MYSQL_USER: + MYSQL_PASSWORD: + ports: + - "3306:3306" + volumes: + - mysql_data:/var/lib/mysql +volumes: + mysql_data: diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml new file mode 100644 index 00000000..22226c06 --- /dev/null +++ b/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,22 @@ + + + + org.example.Product + + + + + + + + + + + + + + + From 9076609d44543e3d0265c05c07dc67d913f52881 Mon Sep 17 00:00:00 2001 From: EraiicPhu Date: Tue, 16 Dec 2025 10:55:41 +0100 Subject: [PATCH 3/4] Change of password + review of code branch Co-authored-by: Anna Ziafar --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 18509cce..282619f1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,7 +7,7 @@ services: MYSQL_ROOT_PASSWORD: rootpassword MYSQL_DATABASE: app_db MYSQL_USER: - MYSQL_PASSWORD: + MYSQL_PASSWORD: PASSWORD ports: - "3306:3306" volumes: From 8edaa274b3500448440a9de9336e89e148f5c6dc Mon Sep 17 00:00:00 2001 From: Dino Date: Wed, 17 Dec 2025 14:31:34 +0100 Subject: [PATCH 4/4] Skapar Booking entity --- .../java/org/example/entities/Booking.java | 46 +++++++++++++++++++ src/main/resources/META-INF/persistence.xml | 20 ++++---- 2 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 src/main/java/org/example/entities/Booking.java diff --git a/src/main/java/org/example/entities/Booking.java b/src/main/java/org/example/entities/Booking.java new file mode 100644 index 00000000..4832a48b --- /dev/null +++ b/src/main/java/org/example/entities/Booking.java @@ -0,0 +1,46 @@ +package org.example.entities; + +import jakarta.persistence.*; +import java.time.LocalDateTime; + +@Entity +@Table(name = "booking") +public class Booking { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "restaurant_id", nullable = false) + private Long restaurantId; + + @Column(name = "customer_id", nullable = false) + private Long customerId; + + @Column(name = "table_id", nullable = false) + private Long tableId; + + @Column(name = "booking_start", nullable = false) + private LocalDateTime bookingStart; + + @Column(name = "booking_end", nullable = false) + private LocalDateTime bookingEnd; + + protected Booking() { } + + public Booking(Long restaurantId, Long customerId, Long tableId, + LocalDateTime bookingStart, LocalDateTime bookingEnd) { + this.restaurantId = restaurantId; + this.customerId = customerId; + this.tableId = tableId; + this.bookingStart = bookingStart; + this.bookingEnd = bookingEnd; + } + + public Long getId() { return id; } + public Long getRestaurantId() { return restaurantId; } + public Long getCustomerId() { return customerId; } + public Long getTableId() { return tableId; } + public LocalDateTime getBookingStart() { return bookingStart; } + public LocalDateTime getBookingEnd() { return bookingEnd; } +} diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index 22226c06..c2506b42 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -3,20 +3,24 @@ xmlns="https://jakarta.ee/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_2.xsd"> + - org.example.Product + + + org.example.entities.Booking + - - + + + - - - + + + - - +