-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from GeorgeApos/create-table-compose
Add student table and compose
- Loading branch information
Showing
5 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: "3.3" | ||
|
||
services: | ||
backend: | ||
build: | ||
context: . | ||
container_name: backend | ||
depends_on: | ||
- db | ||
environment: | ||
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/test_db | ||
- SPRING_DATASOURCE_USERNAME=root | ||
- SPRING_DATASOURCE_PASSWORD=root | ||
ports: | ||
- '8080:8080' | ||
|
||
db: | ||
image: postgres:14.7 | ||
container_name: db | ||
environment: | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: test_db | ||
volumes: | ||
- postgresql:/var/lib/postgresql | ||
- postgresql_data:/var/lib/postgresql/data | ||
ports: | ||
- '5432:5432' | ||
|
||
volumes: | ||
postgresql: | ||
postgresql_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.example.demo; | ||
|
||
import jakarta.persistence.*;; | ||
|
||
@Entity | ||
public class Student { | ||
|
||
@Id | ||
@GeneratedValue | ||
private Long id; | ||
private String name; | ||
|
||
public Student(){ | ||
|
||
} | ||
|
||
public Student(String name){ | ||
this.name = name; | ||
} | ||
|
||
public Long getId(){ | ||
return id; | ||
} | ||
|
||
public void setId(Long id){ | ||
this.id = id; | ||
} | ||
|
||
public String getName(){ | ||
return name; | ||
} | ||
|
||
public void setName(String name){ | ||
this.name = name; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
|
||
spring.datasource.url=jdbc:postgresql://localhost:5432/test_db | ||
spring.datasource.username=root | ||
spring.datasource.password=root | ||
spring.datasource.driver-class-name=org.postgresql.Driver | ||
spring.jpa.hibernate.ddl-auto=update | ||
spring.jpa.show-sql=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters