From 7cb5d09edf705313503eb74133e7396e8c7c8206 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Thu, 30 Apr 2020 16:17:42 +0700 Subject: [PATCH] updated --- pom.xml | 7 ++++--- src/main/java/com/chantha/springdemo/model/Food.java | 5 ++--- src/main/resources/application.properties | 9 +++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 00045c4..2c3fa3e 100644 --- a/pom.xml +++ b/pom.xml @@ -50,10 +50,11 @@ thymeleaf-layout-dialect - + - mysql - mysql-connector-java + org.postgresql + postgresql + runtime diff --git a/src/main/java/com/chantha/springdemo/model/Food.java b/src/main/java/com/chantha/springdemo/model/Food.java index f64069b..c489cce 100644 --- a/src/main/java/com/chantha/springdemo/model/Food.java +++ b/src/main/java/com/chantha/springdemo/model/Food.java @@ -1,14 +1,13 @@ package com.chantha.springdemo.model; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import javax.persistence.*; @Entity @Table(name="tbfood") public class Food { @Id + @GeneratedValue(strategy = GenerationType.AUTO) private long id; public Food() { super(); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 941cfd4..bd3c33f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,7 @@ spring.thymeleaf.cache=false spring.jpa.hibernate.ddl-auto=update -spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3309/dbfood?createDatabaseIfNotExist=true&allowPublicKeyRetrieval=true&useSSL=false -spring.datasource.username=root -spring.datasource.password=root -spring.jpa.open-in-view=true \ No newline at end of file +spring.datasource.url=jdbc:postgresql://localhost:5432/dbfoof +spring.datasource.username=postgres +spring.datasource.password=postgres +spring.jpa.open-in-view=true +server.port=8010 \ No newline at end of file