-
Notifications
You must be signed in to change notification settings - Fork 19
Entity/restaurant #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
149e0ca
946936d
9076609
5ed23e5
d6402c7
2888c12
929e8bc
1b0618e
e51c6ec
8651770
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| target/ | ||
| /.idea/ | ||
| .env |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| FROM eclipse-temurin:21-jdk | ||
|
|
||
| COPY src/main/java/org/example/App.java /App.java | ||
|
|
||
| ENTRYPOINT ["java", "/App.java"] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| [33mcommit 149e0caf9a2d36b0dfd9254b37c62c2bb73d2f0c[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mmain[m[33m, [m[1;31morigin/main[m[33m, [m[1;31morigin/HEAD[m[33m)[m | ||
| Author: github-classroom[bot] <66690702+github-classroom[bot]@users.noreply.github.com> | ||
| Date: Mon Dec 15 09:40:48 2025 +0000 | ||
|
|
||
| add deadline | ||
|
|
||
| [33mcommit 879440803daa45b536e2ea5f3ec269d1be62bf04[m[33m ([m[1;31mupstream/main[m[33m, [m[1;31mupstream/HEAD[m[33m)[m | ||
| Author: Martin Blomberg <martin.blomberg@outlook.com> | ||
| Date: Sun Dec 14 16:07:37 2025 +0100 | ||
|
|
||
| Setup for JPA application | ||
|
|
||
| [33mcommit 539e1a559ab7607b40651315e45ef50074c51b8c[m | ||
| 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] <support@github.com> | ||
| Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | ||
|
|
||
| [33mcommit c9a2be0c3d4286e6322bb017f66aa77bbaaa5a00[m | ||
| Author: github-classroom[bot] <66690702+github-classroom[bot]@users.noreply.github.com> | ||
| Date: Sun Dec 14 12:51:33 2025 +0000 | ||
|
|
||
| Initial commit | ||
|
Comment on lines
+1
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this accidentally committed file. This file appears to be git log output that was accidentally committed. The filename Remove this file from the PR: git rm dfg🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| services: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mysql: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: mysql:9.5.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| container_name: mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MYSQL_ROOT_PASSWORD: rootpassword | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MYSQL_ROOT_HOST: "%" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MYSQL_DATABASE: app_db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MYSQL_USER: grupp2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MYSQL_PASSWORD: ${PASSWORD} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - "3306:3306" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - mysql_data:/var/lib/mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mysql_data: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent docker-compose configurations and hardcoded credentials. There are two docker-compose files with conflicting configurations:
Also, services:
mysql:
image: mysql:9.5.0
container_name: mysql
environment:
- MYSQL_ROOT_PASSWORD: rootpassword
+ MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: app_db
MYSQL_USER: grupp2
MYSQL_PASSWORD: ${PASSWORD}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||||||||||
| FROM eclipse-temurin:25-jdk | ||||||||||||||
| COPY target/classes/org/example/App.class /app/Docker/App.class | ||||||||||||||
| ENTRYPOINT ["java", "-cp", "/app", "Docker.Demo"] | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+1
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Class mismatch will cause runtime failure. The Dockerfile copies Either copy the correct class file or fix the entrypoint to match: FROM eclipse-temurin:25-jdk
-COPY target/classes/org/example/App.class /app/Docker/App.class
-ENTRYPOINT ["java", "-cp", "/app", "Docker.Demo"]
+COPY target/classes/org/example/App.class /app/org/example/App.class
+ENTRYPOINT ["java", "-cp", "/app", "org.example.App"]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| services: | ||
| mysql: | ||
| image: mysql:9.5.0 | ||
| environment: | ||
| MYSQL_ROOT_PASSWORD: root | ||
| MYSQL_ROOT_HOST: "%" | ||
| MYSQL_DATABASE: test | ||
| MYSQL_USER: grupp2 | ||
| MYSQL_PASSWORD: morot7 | ||
|
Comment on lines
+4
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded database credentials committed to repository. Sensitive credentials ( services:
mysql:
image: mysql:9.5.0
environment:
- MYSQL_ROOT_PASSWORD: root
+ MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_ROOT_HOST: "%"
- MYSQL_DATABASE: test
+ MYSQL_DATABASE: ${MYSQL_DATABASE:-app_db}
MYSQL_USER: grupp2
- MYSQL_PASSWORD: morot7
+ MYSQL_PASSWORD: ${MYSQL_PASSWORD}Add a
🤖 Prompt for AI Agents |
||
| ports: | ||
| - "3306:3306" | ||
| volumes: | ||
| - mysql_data:/var/lib/mysql | ||
|
|
||
|
|
||
| volumes: | ||
| mysql_data: | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,78 @@ | ||||||||||
| package org.example.entities; | ||||||||||
|
|
||||||||||
| import jakarta.persistence.*; | ||||||||||
|
|
||||||||||
| import java.time.LocalTime; | ||||||||||
|
|
||||||||||
| @Entity | ||||||||||
| public class OpeningHours { | ||||||||||
|
|
||||||||||
| @Id | ||||||||||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||||||
| private Long id; | ||||||||||
|
|
||||||||||
| @Enumerated(EnumType.STRING) | ||||||||||
| private Weekday weekday; | ||||||||||
|
|
||||||||||
| private LocalTime openingTime; | ||||||||||
| private LocalTime closingTime; | ||||||||||
|
Comment on lines
+8
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Missing The
🔎 Apply this diff to add the bidirectional relationship:Add a @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
+ @ManyToOne
+ @JoinColumn(name = "restaurant_id")
+ private Restaurant restaurant;
+
@Enumerated(EnumType.STRING)
private Weekday weekday;Update the constructor to accept the - public OpeningHours(Weekday weekday, LocalTime openingTime, LocalTime closingTime) {
+ public OpeningHours(Restaurant restaurant, Weekday weekday, LocalTime openingTime, LocalTime closingTime) {
+ this.restaurant = restaurant;
this.weekday = weekday;Add getter and setter for the restaurant field: public Restaurant getRestaurant() {
return restaurant;
}
public void setRestaurant(Restaurant restaurant) {
this.restaurant = restaurant;
}Additionally, fix the // In Restaurant.java, change from:
@OneToMany
@JoinColumn(name = "openingHoursId")
private List<OpeningHours> openingHours = new ArrayList<>();
// To:
@OneToMany(mappedBy = "restaurant")
private List<OpeningHours> openingHours = new ArrayList<>();Based on the relationship structure observed in Restaurant.java and standard JPA bidirectional OneToMany/ManyToOne patterns.
🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| public OpeningHours(Long id, Weekday weekday, LocalTime openingTime, LocalTime closingTime) { | ||||||||||
| this.id = id; | ||||||||||
| this.weekday = weekday; | ||||||||||
| this.openingTime = openingTime; | ||||||||||
| this.closingTime = closingTime; | ||||||||||
| if(openingTime.isAfter(closingTime)) | ||||||||||
| throw new RuntimeException("Opening time cannot be after closing time"); | ||||||||||
|
Comment on lines
+25
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use The validation throws a generic 🔎 Apply this diff: if(openingTime.isAfter(closingTime))
- throw new RuntimeException("Opening time cannot be after closing time");
+ throw new IllegalArgumentException("Opening time cannot be after closing time");📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| } | ||||||||||
|
|
||||||||||
| public OpeningHours(){} | ||||||||||
|
|
||||||||||
| public Long getId() { | ||||||||||
| return id; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public Weekday getWeekday() { | ||||||||||
| return weekday; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public void setWeekday(Weekday weekday) { | ||||||||||
| this.weekday = weekday; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public LocalTime getOpeningTime() { | ||||||||||
| return openingTime; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public void setOpeningTime(LocalTime opening_time) { | ||||||||||
| this.openingTime = opening_time; | ||||||||||
| } | ||||||||||
|
Comment on lines
+47
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add validation to setters to maintain time constraints. The constructor validates that OpeningHours hours = new OpeningHours(Weekday.MONDAY, LocalTime.of(9, 0), LocalTime.of(17, 0)); // Valid
hours.setOpeningTime(LocalTime.of(18, 0)); // Now opening > closing, but no validation!🔎 Suggested fix - extract validation and apply in setters:First, extract the validation to a private method: private void validateTimes(LocalTime opening, LocalTime closing) {
if (opening != null && closing != null && opening.isAfter(closing)) {
throw new IllegalArgumentException("Opening time cannot be after closing time");
}
}Then update the constructor: public OpeningHours(Weekday weekday, LocalTime openingTime, LocalTime closingTime) {
this.weekday = weekday;
this.openingTime = openingTime;
this.closingTime = closingTime;
- if(openingTime.isAfter(closingTime))
- throw new RuntimeException("Opening time cannot be after closing time");
+ validateTimes(openingTime, closingTime);
}And add validation to both setters: public void setOpeningTime(LocalTime opening_time) {
+ validateTimes(opening_time, this.closingTime);
this.openingTime = opening_time;
} public void setClosingTime(LocalTime closing_time) {
+ validateTimes(this.openingTime, closing_time);
this.closingTime = closing_time;
}Also applies to: 55-57 🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| public LocalTime getClosingTime() { | ||||||||||
| return closingTime; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public void setClosingTime(LocalTime closing_time) { | ||||||||||
| this.closingTime = closing_time; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public String toString() { | ||||||||||
| return "OpeningHours{" + | ||||||||||
| "id=" + id + | ||||||||||
| ", weekday='" + weekday + '\'' + | ||||||||||
| ", openingTime=" + openingTime + | ||||||||||
| ", closingTime=" + closingTime + | ||||||||||
| '}'; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| enum Weekday{ | ||||||||||
| MONDAY, | ||||||||||
| TUESDAY, | ||||||||||
| WEDNESDAY, | ||||||||||
| THURSDAY, | ||||||||||
| FRIDAY, | ||||||||||
| SATURDAY, | ||||||||||
| SUNDAY | ||||||||||
| } | ||||||||||
| } | ||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,92 @@ | ||||||||||||||||||||||||
| package org.example.entities; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import jakarta.persistence.*; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import java.math.BigDecimal; | ||||||||||||||||||||||||
| import java.util.ArrayList; | ||||||||||||||||||||||||
| import java.util.List; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Entity | ||||||||||||||||||||||||
| public class Restaurant { | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Id | ||||||||||||||||||||||||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||||||||||||||||||||
| private Long id; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @OneToMany | ||||||||||||||||||||||||
| @JoinColumn(name = "openingHoursId") | ||||||||||||||||||||||||
| private List<OpeningHours> openingHours = new ArrayList<>(); | ||||||||||||||||||||||||
|
Comment on lines
+16
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the join column name to reflect the correct relationship. The join column name 🔎 Apply this diff to fix the join column name: @OneToMany
-@JoinColumn(name = "openingHoursId")
+@JoinColumn(name = "restaurantId")
private List<OpeningHours> openingHours = new ArrayList<>();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents🧩 Analysis chain🏁 Script executed: find src/main/java -type f -name "*.java" | head -20Repository: ithsjava25/ithsjava25-java-project-jpa-maven-java-template Length of output: 240 🏁 Script executed: cat -n src/main/java/org/example/entities/OpeningHours.javaRepository: ithsjava25/ithsjava25-java-project-jpa-maven-java-template Length of output: 1975 🏁 Script executed: cat -n src/main/java/org/example/entities/Restaurant.javaRepository: ithsjava25/ithsjava25-java-project-jpa-maven-java-template Length of output: 2746 Fix the bidirectional relationship configuration between Restaurant and OpeningHours. The relationship is incomplete and incorrectly configured:
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| private String name; | ||||||||||||||||||||||||
| private String category; | ||||||||||||||||||||||||
| private String address; | ||||||||||||||||||||||||
| private BigDecimal priceRange; | ||||||||||||||||||||||||
| private double rating; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public Restaurant(Long id, String name, String category, String address, BigDecimal priceRange, double rating) { | ||||||||||||||||||||||||
| this.id = id; | ||||||||||||||||||||||||
| this.name = name; | ||||||||||||||||||||||||
| this.category = category; | ||||||||||||||||||||||||
| this.address = address; | ||||||||||||||||||||||||
| this.priceRange = priceRange; | ||||||||||||||||||||||||
| this.rating = rating; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public Restaurant(){} | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public Long getId() { | ||||||||||||||||||||||||
| return id; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public String getName() { | ||||||||||||||||||||||||
| return name; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public void setName(String name) { | ||||||||||||||||||||||||
| this.name = name; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public String getCategory() { | ||||||||||||||||||||||||
| return category; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public void setCategory(String category) { | ||||||||||||||||||||||||
| this.category = category; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public String getAddress() { | ||||||||||||||||||||||||
| return address; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public void setAddress(String address) { | ||||||||||||||||||||||||
| this.address = address; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public BigDecimal getPriceRange() { | ||||||||||||||||||||||||
| return priceRange; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public void setPriceRange(BigDecimal price_range) { | ||||||||||||||||||||||||
| this.priceRange = price_range; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public double getRating() { | ||||||||||||||||||||||||
| return rating; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public void setRating(double rating) { | ||||||||||||||||||||||||
| this.rating = rating; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add missing getters and setters for the The 🔎 Add these methods before the toString:+public List<OpeningHours> getOpeningHours() {
+ return openingHours;
+}
+
+public void setOpeningHours(List<OpeningHours> openingHours) {
+ this.openingHours = openingHours;
+}
+
@Override
public String toString() {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| public String toString() { | ||||||||||||||||||||||||
| return "Restaurant{" + | ||||||||||||||||||||||||
| "id=" + id + | ||||||||||||||||||||||||
| ", name='" + name + '\'' + | ||||||||||||||||||||||||
| ", category='" + category + '\'' + | ||||||||||||||||||||||||
| ", address='" + address + '\'' + | ||||||||||||||||||||||||
| ", priceRange=" + priceRange + | ||||||||||||||||||||||||
| ", rating=" + rating + | ||||||||||||||||||||||||
| '}'; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||||||
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||||||||||||
| <persistence version="3.2" | ||||||||||||
| 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"> | ||||||||||||
| <persistence-unit name="jpa-hibernate-mysql"> | ||||||||||||
| <class>org.example.Product</class> | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing entity class registrations. The persistence unit references <persistence-unit name="jpa-hibernate-mysql">
- <class>org.example.Product</class>
+ <class>org.example.entities.Restaurant</class>
+ <class>org.example.entities.OpeningHours</class>
<properties>Alternatively, if 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| <properties> | ||||||||||||
| <!-- Database connection settings --> | ||||||||||||
| <property name="jakarta.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/test"/> | ||||||||||||
| <property name="jakarta.persistence.jdbc.user" value="root"/> | ||||||||||||
| <property name="jakarta.persistence.jdbc.password" value="root"/> | ||||||||||||
|
Comment on lines
+10
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded database credentials in persistence configuration. Database username and password are hardcoded. For production, consider using environment variable substitution or a separate configuration mechanism. For development, this is acceptable if credentials match the docker-compose setup. However, note that the database name |
||||||||||||
| <!-- Automatically export the schema --> | ||||||||||||
| <property name="hibernate.archive.autodetection" value="class"/> | ||||||||||||
| <property name="hibernate.hbm2ddl.auto" value="update"/> | ||||||||||||
| <!-- Echo all executed SQL to console --> | ||||||||||||
| <property name="hibernate.show_sql" value="true"/> | ||||||||||||
| <property name="hibernate.format_sql" value="true"/> | ||||||||||||
| <property name="hibernate.highlight_sql" value="true"/> | ||||||||||||
| </properties> | ||||||||||||
| </persistence-unit> | ||||||||||||
| </persistence> | ||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source-file execution won't work with JPA dependencies.
Running
java /App.javauses Java's single-file source execution, which doesn't support external dependencies. Since the application uses JPA/Hibernate, this approach will fail.Consider building with Maven and running the compiled application:
🤖 Prompt for AI Agents