From 2ebd9c8adb487b5b5fd3e6e94a71a0360b144f86 Mon Sep 17 00:00:00 2001 From: Neha Verma Date: Thu, 2 Jan 2025 20:23:02 +0530 Subject: [PATCH 1/6] Update pom.xml Upgraded java and spring boot version --- starter_code/pom.xml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/starter_code/pom.xml b/starter_code/pom.xml index 608bb212f..69c854116 100644 --- a/starter_code/pom.xml +++ b/starter_code/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.5.RELEASE + 3.3.5 com.example @@ -16,7 +16,7 @@ Demo project for Spring Boot - 1.8 + 21 3.1.1 @@ -29,10 +29,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework.boot - spring-boot-starter-tomcat - com.h2database @@ -44,12 +40,9 @@ spring-boot-starter-test test + - - org.codehaus.mojo - tomcat-maven-plugin - 1.1 - + From 8129481d68966009cf89c982914ea75b29f85de0 Mon Sep 17 00:00:00 2001 From: Neha Verma Date: Thu, 2 Jan 2025 20:23:56 +0530 Subject: [PATCH 2/6] Update application.properties --- .../src/main/resources/application.properties | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/starter_code/src/main/resources/application.properties b/starter_code/src/main/resources/application.properties index ed303a7d4..d7366e9e6 100644 --- a/starter_code/src/main/resources/application.properties +++ b/starter_code/src/main/resources/application.properties @@ -1,6 +1,12 @@ spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.url=jdbc:h2:mem:bootapp;DB_CLOSE_DELAY=-1 +spring.datasource.url=jdbc:h2:mem:bootapp;NON_KEYWORDS=user spring.datasource.username=sa spring.datasource.password= -spring.jpa.hibernate.ddl-auto=update -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect \ No newline at end of file +spring.jpa.hibernate.ddl-auto=create +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect +spring.jpa.defer-datasource-initialization=true +spring.jpa.properties.hibernate.format_sql=true + +server.port=8080 +spring.h2.console.enabled=true +spring.h2.console.path=/h2 From c3ae9b237f27a747947bb4eaa6a08f60a4487817 Mon Sep 17 00:00:00 2001 From: Neha Verma Date: Thu, 2 Jan 2025 20:24:45 +0530 Subject: [PATCH 3/6] Update Cart.java --- .../example/demo/model/persistence/Cart.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/starter_code/src/main/java/com/example/demo/model/persistence/Cart.java b/starter_code/src/main/java/com/example/demo/model/persistence/Cart.java index 053906c31..511545487 100644 --- a/starter_code/src/main/java/com/example/demo/model/persistence/Cart.java +++ b/starter_code/src/main/java/com/example/demo/model/persistence/Cart.java @@ -2,22 +2,19 @@ import java.math.BigDecimal; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToMany; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; -import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; + @Entity @Table(name = "cart") public class Cart { From daef6dfb371ab661f5a7f33d010172d159b392f5 Mon Sep 17 00:00:00 2001 From: Neha Verma Date: Thu, 2 Jan 2025 20:25:10 +0530 Subject: [PATCH 4/6] Update Item.java --- .../example/demo/model/persistence/Item.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/starter_code/src/main/java/com/example/demo/model/persistence/Item.java b/starter_code/src/main/java/com/example/demo/model/persistence/Item.java index 2ce3ae412..80334570c 100644 --- a/starter_code/src/main/java/com/example/demo/model/persistence/Item.java +++ b/starter_code/src/main/java/com/example/demo/model/persistence/Item.java @@ -2,14 +2,14 @@ import java.math.BigDecimal; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -90,8 +90,5 @@ public String getDescription() { public void setDescription(String description) { this.description = description; - } - - - + } } From 20113f99021d3ff8ba1f6f1146fe7616c7cf87af Mon Sep 17 00:00:00 2001 From: Neha Verma Date: Thu, 2 Jan 2025 20:25:31 +0530 Subject: [PATCH 5/6] Update User.java --- .../example/demo/model/persistence/User.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/starter_code/src/main/java/com/example/demo/model/persistence/User.java b/starter_code/src/main/java/com/example/demo/model/persistence/User.java index ab85ccc60..00663ac70 100644 --- a/starter_code/src/main/java/com/example/demo/model/persistence/User.java +++ b/starter_code/src/main/java/com/example/demo/model/persistence/User.java @@ -1,18 +1,18 @@ package com.example.demo.model.persistence; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.Table; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; + @Entity @Table(name = "user") @@ -54,8 +54,5 @@ public String getUsername() { public void setUsername(String username) { this.username = username; - } - - - + } } From e0197cf13c30306c53f97be3edb62492ae2bfb27 Mon Sep 17 00:00:00 2001 From: Neha Verma Date: Thu, 2 Jan 2025 20:26:00 +0530 Subject: [PATCH 6/6] Update UserOrder.java --- .../demo/model/persistence/UserOrder.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/starter_code/src/main/java/com/example/demo/model/persistence/UserOrder.java b/starter_code/src/main/java/com/example/demo/model/persistence/UserOrder.java index 60e1bc490..d8eeaaf84 100644 --- a/starter_code/src/main/java/com/example/demo/model/persistence/UserOrder.java +++ b/starter_code/src/main/java/com/example/demo/model/persistence/UserOrder.java @@ -4,17 +4,17 @@ import java.util.List; import java.util.stream.Collectors; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; import com.fasterxml.jackson.annotation.JsonProperty;