From 21b33c3e86aa2bdba726bc527f5ba306812cf68e Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Wed, 16 Mar 2022 21:50:07 +0330 Subject: daily commit.wip --- build.gradle.kts | 11 ++++++----- docker-compose.yaml | 2 ++ src/main/java/com/terminaldweller/doc/Doc.java | 13 +++++++++++++ src/main/resources/application.properties | 6 +++--- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d08e6f6..30630b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { // application id("org.springframework.boot") version "2.6.4" id("io.spring.dependency-management") version "1.0.11.RELEASE" - id("java") + id("java-library") } repositories { @@ -12,10 +12,11 @@ repositories { } dependencies { - // implementation("org.springframework.boot:spring-boot-starter-data-jdbc") + implementation("org.springframework.boot:spring-boot-starter-data-jdbc") + implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.springframework.boot:spring-boot-starter-web") - // runtimeOnly("org.postgresql:postgresql") - testImplementation("org.springframework.boot:spring-boot-starter-test") + runtimeOnly("org.postgresql:postgresql") + testImplementation("org.hibernate.javax.persistence:hibernate-jpa-2.1-api") } // tasks.create("FatJar", Jar::class) { @@ -59,6 +60,6 @@ java { tasks.compileJava { options.isIncremental = true options.isFork = true - options.isFailOnError = false + options.isFailOnError = true options.release.set(11) } diff --git a/docker-compose.yaml b/docker-compose.yaml index a357384..27bb3d0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,6 +12,7 @@ services: - ALL environment: - DOCKER_DEPLOYMENT_TYPE=deployment + # restart: unless-stopped postgres: image: postgres:14-alpine networks: @@ -30,6 +31,7 @@ services: - pg_user_secret - pg_initdb_args_secret - pg_db_secret + # restart: unless-stopped networks: springnet: volumes: diff --git a/src/main/java/com/terminaldweller/doc/Doc.java b/src/main/java/com/terminaldweller/doc/Doc.java index c746692..1ec9dca 100644 --- a/src/main/java/com/terminaldweller/doc/Doc.java +++ b/src/main/java/com/terminaldweller/doc/Doc.java @@ -1,8 +1,21 @@ package com.terminaldweller.doc; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + /** The document class. */ +@Entity +@Table public class Doc { + @Id + @SequenceGenerator(name = "doc_sequence", sequenceName = "doc_sequence", allocationSize = 1) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "doc_sequence") private Long id; + private String name; private long lastModified; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 547f233..e0578c9 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ -spring.datasource.url=jdbc:postgresql://postgres:5432 -spring.datasource.username= -spring.datasource.password= +spring.datasource.url=jdbc:postgresql://postgres:5432/ +spring.datasource.username=spring +spring.datasource.password=qwerqty spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.show-sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -- cgit v1.2.3