-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d879b0
commit 066dd07
Showing
5 changed files
with
138 additions
and
12 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 |
---|---|---|
@@ -1,5 +1,47 @@ | ||
package com.github.perscholas.model; | ||
|
||
// TODO - Annotate and Implement respective interface and define behaviors | ||
public class Course { | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import java.util.Objects; | ||
|
||
@Entity | ||
public class Course implements CourseInterface { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private Integer id; | ||
private String name; | ||
private String instructor; | ||
|
||
@Override | ||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
@Override | ||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String getInstructor() { | ||
return instructor; | ||
} | ||
|
||
@Override | ||
public void setInstructor(String instructor) { | ||
this.instructor = instructor; | ||
} | ||
} |
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,5 +1,79 @@ | ||
package com.github.perscholas.model; | ||
|
||
// TODO - Annotate and Implement respective interface and define behaviors | ||
public class Student { | ||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
@Entity | ||
public class Student implements StudentInterface { | ||
|
||
private String email; | ||
private String name; | ||
private String password; | ||
private List<CourseInterface> studentCourses; | ||
|
||
public Student() { | ||
studentCourses = new ArrayList<>(); | ||
} | ||
|
||
@Override | ||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
@Override | ||
public void setEmail(String email) { | ||
this.email = email; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
@Override | ||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public List<CourseInterface> getStudentCourses() { | ||
return studentCourses; | ||
} | ||
|
||
public void setStudentCourses(List<CourseInterface> studentCourses) { | ||
this.studentCourses = studentCourses; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Student{" + | ||
"email='" + email + '\'' + | ||
", name='" + name + '\'' + | ||
", password='" + password + '\'' + | ||
", studentCourses=" + studentCourses + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof Student)) return false; | ||
Student student = (Student) o; | ||
return email.equals(student.email) && | ||
Objects.equals(name, student.name) && | ||
Objects.equals(password, student.password); | ||
} | ||
} |
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,5 @@ | ||
CREATE TABLE Courses ( | ||
ID int NOT NULL PRIMARY KEY, | ||
NAME varchar(50) NOT NULL, | ||
INSTRUCTOR varchar(50) NOT NULL | ||
); |
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,10 +1,10 @@ | ||
insert into Course (id, name, instructor) values (1, 'English', 'Anderea Scamaden'); | ||
insert into Course (id, name, instructor) values (2, 'Mathematics', 'Eustace Niemetz'); | ||
insert into Course (id, name, instructor) values (3, 'Anatomy', 'Reynolds Pastor'); | ||
insert into Course (id, name, instructor) values (4, 'Organic Chemistry', 'Odessa Belcher'); | ||
insert into Course (id, name, instructor) values (5, 'Physics', 'Dani Swallow'); | ||
insert into Course (id, name, instructor) values (6, 'Digital Logic', 'Glenden Reilingen'); | ||
insert into Course (id, name, instructor) values (7, 'Object Oriented Programming','Giselle Ardy'); | ||
insert into Course (id, name, instructor) values (8, 'Data Structures', 'Carolan Stoller'); | ||
insert into Course (id, name, instructor) values (9, 'Politics', 'Carmita De Maine'); | ||
insert into Course (id, name, instructor) values (10, 'Art', 'Kingsly Doxsey'); | ||
insert into Courses (id, name, instructor) values (1, 'English', 'Anderea Scamaden'); | ||
insert into Courses (id, name, instructor) values (2, 'Mathematics', 'Eustace Niemetz'); | ||
insert into Courses (id, name, instructor) values (3, 'Anatomy', 'Reynolds Pastor'); | ||
insert into Courses (id, name, instructor) values (4, 'Organic Chemistry', 'Odessa Belcher'); | ||
insert into Courses (id, name, instructor) values (5, 'Physics', 'Dani Swallow'); | ||
insert into Courses (id, name, instructor) values (6, 'Digital Logic', 'Glenden Reilingen'); | ||
insert into Courses (id, name, instructor) values (7, 'Object Oriented Programming','Giselle Ardy'); | ||
insert into Courses (id, name, instructor) values (8, 'Data Structures', 'Carolan Stoller'); | ||
insert into Courses (id, name, instructor) values (9, 'Politics', 'Carmita De Maine'); | ||
insert into Courses (id, name, instructor) values (10, 'Art', 'Kingsly Doxsey'); |
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,5 @@ | ||
CREATE TABLE Student ( | ||
Email varchar(50) NOT NULL PRIMARY KEY, | ||
Name varchar(50) NOT NULL, | ||
Password varchar(50) NOT NULL | ||
); |