Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
student-personal-details-spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
student-details-microservice
student-personal-details-spring-boot
Commits
124fe2b7
Commit
124fe2b7
authored
Apr 02, 2021
by
Darrick Yong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add connection to local PG database
parent
7863ba51
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
9 deletions
+14
-9
README.md
README.md
+4
-1
build.gradle
build.gradle
+2
-2
Student.java
src/main/java/com/student/details/models/Student.java
+0
-2
StudentRepository.java
...a/com/student/details/repositories/StudentRepository.java
+1
-2
application.properties
src/main/resources/application.properties
+1
-2
insert_data.sql
src/main/resources/insert_data.sql
+6
-0
No files found.
README.md
View file @
124fe2b7
...
...
@@ -2,7 +2,10 @@
# Setup postgres docker container
docker create --name student-details-pgdb -e POSTGRES_PASSWORD=admin -p 5432:5432 postgres:11.5-alpine
# Enter into the psql shell and create the database
# Start the postgres docker container
docker start student-details-pgdb
# Below will enter into the psql shell and create the database
docker exec -it student-details-pgdb psql -U postgres
(psql) create database student_details;
...
...
build.gradle
View file @
124fe2b7
...
...
@@ -14,10 +14,10 @@ repositories {
dependencies
{
implementation
'org.springframework.boot:spring-boot-starter-web'
//
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation
'org.springframework.boot:spring-boot-starter-data-jpa'
implementation
'org.springframework.boot:spring-boot-starter-actuator'
implementation
'org.springframework.boot:spring-boot-starter-validation'
//
runtimeOnly 'org.postgresql:postgresql'
runtimeOnly
'org.postgresql:postgresql'
testImplementation
'org.springframework.boot:spring-boot-starter-test'
}
...
...
src/main/java/com/student/details/models/Student.java
View file @
124fe2b7
/*
package
com
.
student
.
details
.
models
;
import
javax.persistence.*
;
...
...
@@ -79,4 +78,3 @@ public class Student {
this
.
course
=
course
;
}
}
*/
src/main/java/com/student/details/repositories/StudentRepository.java
View file @
124fe2b7
/*
package
com
.
student
.
details
.
repositories
;
import
com.student.details.models.Student
;
...
...
@@ -8,4 +7,4 @@ import org.springframework.stereotype.Repository;
@Repository
public
interface
StudentRepository
extends
JpaRepository
<
Student
,
Long
>
{
}
*/
src/main/resources/application.properties
View file @
124fe2b7
...
...
@@ -2,13 +2,12 @@
spring.datasource.initialization-mode
=
always
spring.datasource.initialize
=
true
spring.datasource.schema
=
classpath:/schema.sql
spring.datasource.continue-on-error
=
true
DB_URL
=
jdbc:postgresql://localhost:5432/student_details
spring.datasource.url
=
${DB_URL}
spring.datasource.username
=
postgres
spring.datasource.password
=
*password from last step*
spring.datasource.password
=
admin
spring.jpa.database-platform
=
org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto
=
none
spring.jpa.hibernate.show-sql
=
true
\ No newline at end of file
src/main/resources/insert_data.sql
0 → 100644
View file @
124fe2b7
INSERT
INTO
student_details
(
email
,
firstName
,
lastName
,
dateOfBirth
,
course
)
VALUES
(
'dyong@nisum.com'
,
'Darrick'
,
'Yong'
,
DATE
(
'1990-09-08'
),
'Math'
),
(
'apinto@nisum.com'
,
'Alex'
,
'Pinto'
,
DATE
(
'1997-07-04'
),
'English'
),
(
'banderson@nisum.com'
,
'Ben'
,
'Anderson'
,
DATE
(
'1993-09-20'
),
'Chemistry'
),
(
'ccottier@nisum.com'
,
'Chris'
,
'Cottier'
,
DATE
(
'1993-01-03'
),
'Biology'
),
(
'asegers@nisum.com'
,
'Alex'
,
'Segers'
,
DATE
(
'2021-04-01'
),
'Debugging'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment