Skip to content

Commit 1a8c856

Browse files
authored
Merge pull request #2 from CodeHubGreece/koninos
Koninos
2 parents 7d63cae + 3a5bcf0 commit 1a8c856

File tree

12 files changed

+502
-156
lines changed

12 files changed

+502
-156
lines changed

Dump20191209.sql

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
-- MySQL dump 10.13 Distrib 8.0.18, for Win64 (x86_64)
2+
--
3+
-- Host: 127.0.0.1 Database: efkadb
4+
-- ------------------------------------------------------
5+
-- Server version 8.0.18
6+
7+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10+
/*!50503 SET NAMES utf8 */;
11+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12+
/*!40103 SET TIME_ZONE='+00:00' */;
13+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17+
18+
--
19+
-- Table structure for table `appointment`
20+
--
21+
22+
DROP TABLE IF EXISTS `appointment`;
23+
/*!40101 SET @saved_cs_client = @@character_set_client */;
24+
/*!50503 SET character_set_client = utf8mb4 */;
25+
CREATE TABLE `appointment` (
26+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
27+
`citizen_id` int(10) unsigned NOT NULL,
28+
`doctor_id` int(10) unsigned NOT NULL,
29+
`datetime` datetime NOT NULL,
30+
`description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
31+
`notes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
32+
PRIMARY KEY (`id`),
33+
KEY `cit_app_idx` (`citizen_id`),
34+
KEY `doc_app_idx` (`doctor_id`),
35+
CONSTRAINT `cit_app` FOREIGN KEY (`citizen_id`) REFERENCES `citizen` (`id`),
36+
CONSTRAINT `doc_app` FOREIGN KEY (`doctor_id`) REFERENCES `doctor` (`id`)
37+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
38+
/*!40101 SET character_set_client = @saved_cs_client */;
39+
40+
--
41+
-- Dumping data for table `appointment`
42+
--
43+
44+
LOCK TABLES `appointment` WRITE;
45+
/*!40000 ALTER TABLE `appointment` DISABLE KEYS */;
46+
/*!40000 ALTER TABLE `appointment` ENABLE KEYS */;
47+
UNLOCK TABLES;
48+
49+
--
50+
-- Table structure for table `citizen`
51+
--
52+
53+
DROP TABLE IF EXISTS `citizen`;
54+
/*!40101 SET @saved_cs_client = @@character_set_client */;
55+
/*!50503 SET character_set_client = utf8mb4 */;
56+
CREATE TABLE `citizen` (
57+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
58+
`user_id` int(10) unsigned NOT NULL,
59+
`AMKA` int(11) unsigned NOT NULL,
60+
`first_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
61+
`last_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
62+
`email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
63+
`phone_number` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
64+
PRIMARY KEY (`id`),
65+
UNIQUE KEY `AMKA_UNIQUE` (`AMKA`),
66+
UNIQUE KEY `user_id_UNIQUE` (`user_id`),
67+
CONSTRAINT `cit_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
68+
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
69+
/*!40101 SET character_set_client = @saved_cs_client */;
70+
71+
--
72+
-- Dumping data for table `citizen`
73+
--
74+
75+
LOCK TABLES `citizen` WRITE;
76+
/*!40000 ALTER TABLE `citizen` DISABLE KEYS */;
77+
/*!40000 ALTER TABLE `citizen` ENABLE KEYS */;
78+
UNLOCK TABLES;
79+
80+
--
81+
-- Table structure for table `doctor`
82+
--
83+
84+
DROP TABLE IF EXISTS `doctor`;
85+
/*!40101 SET @saved_cs_client = @@character_set_client */;
86+
/*!50503 SET character_set_client = utf8mb4 */;
87+
CREATE TABLE `doctor` (
88+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
89+
`user_id` int(10) unsigned NOT NULL,
90+
`first_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
91+
`last_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
92+
`specialty_id` int(10) unsigned DEFAULT NULL,
93+
PRIMARY KEY (`id`),
94+
UNIQUE KEY `user_id_UNIQUE` (`user_id`),
95+
KEY `fk_spec_idx` (`specialty_id`),
96+
CONSTRAINT `doc_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
97+
CONSTRAINT `fk_spec` FOREIGN KEY (`specialty_id`) REFERENCES `specialty` (`id`)
98+
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
99+
/*!40101 SET character_set_client = @saved_cs_client */;
100+
101+
--
102+
-- Dumping data for table `doctor`
103+
--
104+
105+
LOCK TABLES `doctor` WRITE;
106+
/*!40000 ALTER TABLE `doctor` DISABLE KEYS */;
107+
/*!40000 ALTER TABLE `doctor` ENABLE KEYS */;
108+
UNLOCK TABLES;
109+
110+
--
111+
-- Table structure for table `specialty`
112+
--
113+
114+
DROP TABLE IF EXISTS `specialty`;
115+
/*!40101 SET @saved_cs_client = @@character_set_client */;
116+
/*!50503 SET character_set_client = utf8mb4 */;
117+
CREATE TABLE `specialty` (
118+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
119+
`specialty` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
120+
PRIMARY KEY (`id`)
121+
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
122+
/*!40101 SET character_set_client = @saved_cs_client */;
123+
124+
--
125+
-- Dumping data for table `specialty`
126+
--
127+
128+
LOCK TABLES `specialty` WRITE;
129+
/*!40000 ALTER TABLE `specialty` DISABLE KEYS */;
130+
INSERT INTO `specialty` VALUES (7,'Ksematiasma'),(8,'Ksematiasma'),(9,'Ksematiasma'),(10,'Ksematiasma'),(11,'Ksematiasma'),(12,'Ksematiasma'),(13,'Ksematiasma'),(14,'Ksematiasma'),(15,'Ksematiasma');
131+
/*!40000 ALTER TABLE `specialty` ENABLE KEYS */;
132+
UNLOCK TABLES;
133+
134+
--
135+
-- Table structure for table `user`
136+
--
137+
138+
DROP TABLE IF EXISTS `user`;
139+
/*!40101 SET @saved_cs_client = @@character_set_client */;
140+
/*!50503 SET character_set_client = utf8mb4 */;
141+
CREATE TABLE `user` (
142+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
143+
`type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
144+
`username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
145+
`pwd` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
146+
PRIMARY KEY (`id`),
147+
UNIQUE KEY `username_UNIQUE` (`username`)
148+
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
149+
/*!40101 SET character_set_client = @saved_cs_client */;
150+
151+
--
152+
-- Dumping data for table `user`
153+
--
154+
155+
LOCK TABLES `user` WRITE;
156+
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
157+
INSERT INTO `user` VALUES (14,'d','username23j','password'),(16,'d','usernamess23j','password'),(17,'d','usernamess423j','password'),(18,'d','usernamwsess423j','password'),(19,'d','usernamwsejjss423j','password'),(21,'d','usernsedededmwsejjss423j','password'),(22,'d','usdedmwsejjss423j','password'),(24,'d','usdess423j','password'),(26,'d','usdesfdffs423j','password');
158+
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
159+
UNLOCK TABLES;
160+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
161+
162+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
163+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
164+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
165+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
166+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
167+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
168+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
169+
170+
-- Dump completed on 2019-12-09 18:39:33

sample/src/main/java/org/regeneration/sample/Entities/Appointment.java

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,33 @@
66

77
@Entity
88
public class Appointment {
9+
@Id
10+
@Column(name = "id", nullable = false)
911
private int id;
12+
13+
@Column(name = "citizen_id", nullable = false, insertable = false, updatable = false)
1014
private int citizenId;
15+
16+
@Column(name = "doctor_id", nullable = false, insertable = false, updatable = false)
1117
private int doctorId;
12-
private Timestamp appointmentDatetime;
18+
19+
@Column(name = "datetime", nullable = false)
20+
private Timestamp datetime;
21+
22+
@Column(name = "description", nullable = true, columnDefinition = "TEXT")
1323
private String description;
24+
25+
@Column(name = "notes", nullable = true, columnDefinition = "TEXT")
1426
private String notes;
15-
private Citizen citizenByCitizenId;
16-
private Doctor doctorByDoctorId;
1727

18-
@Id
19-
@Column(name = "id", nullable = false)
28+
@ManyToOne
29+
@JoinColumn(name = "citizen_id", referencedColumnName = "id", nullable = false)
30+
private Citizen citizen;
31+
32+
@ManyToOne
33+
@JoinColumn(name = "doctor_id", referencedColumnName = "id", nullable = false)
34+
private Doctor doctor;
35+
2036
public int getId() {
2137
return id;
2238
}
@@ -25,8 +41,6 @@ public void setId(int id) {
2541
this.id = id;
2642
}
2743

28-
@Basic
29-
@Column(name = "citizen_id", nullable = false, insertable = false, updatable = false)
3044
public int getCitizenId() {
3145
return citizenId;
3246
}
@@ -35,8 +49,6 @@ public void setCitizenId(int citizenId) {
3549
this.citizenId = citizenId;
3650
}
3751

38-
@Basic
39-
@Column(name = "doctor_id", nullable = false, insertable = false, updatable = false)
4052
public int getDoctorId() {
4153
return doctorId;
4254
}
@@ -45,18 +57,14 @@ public void setDoctorId(int doctorId) {
4557
this.doctorId = doctorId;
4658
}
4759

48-
@Basic
49-
@Column(name = "appointment_datetime", nullable = false)
50-
public Timestamp getAppointmentDatetime() {
51-
return appointmentDatetime;
60+
public Timestamp getDatetime() {
61+
return datetime;
5262
}
5363

54-
public void setAppointmentDatetime(Timestamp appointmentDatetime) {
55-
this.appointmentDatetime = appointmentDatetime;
64+
public void setDatetime(Timestamp datetime) {
65+
this.datetime = datetime;
5666
}
5767

58-
@Basic
59-
@Column(name = "description", nullable = true)
6068
public String getDescription() {
6169
return description;
6270
}
@@ -65,8 +73,6 @@ public void setDescription(String description) {
6573
this.description = description;
6674
}
6775

68-
@Basic
69-
@Column(name = "notes", nullable = true)
7076
public String getNotes() {
7177
return notes;
7278
}
@@ -83,33 +89,29 @@ public boolean equals(Object o) {
8389
return id == that.id &&
8490
citizenId == that.citizenId &&
8591
doctorId == that.doctorId &&
86-
Objects.equals(appointmentDatetime, that.appointmentDatetime) &&
92+
Objects.equals(datetime, that.datetime) &&
8793
Objects.equals(description, that.description) &&
8894
Objects.equals(notes, that.notes);
8995
}
9096

9197
@Override
9298
public int hashCode() {
93-
return Objects.hash(id, citizenId, doctorId, appointmentDatetime, description, notes);
99+
return Objects.hash(id, citizenId, doctorId, datetime, description, notes);
94100
}
95101

96-
@ManyToOne
97-
@JoinColumn(name = "citizen_id", referencedColumnName = "id", nullable = false)
98-
public Citizen getCitizenByCitizenId() {
99-
return citizenByCitizenId;
102+
public Citizen getCitizen() {
103+
return citizen;
100104
}
101105

102-
public void setCitizenByCitizenId(Citizen citizenByCitizenId) {
103-
this.citizenByCitizenId = citizenByCitizenId;
106+
public void setCitizenByCitizenId(Citizen citizen) {
107+
this.citizen = citizen;
104108
}
105109

106-
@ManyToOne
107-
@JoinColumn(name = "doctor_id", referencedColumnName = "id", nullable = false)
108110
public Doctor getDoctorByDoctorId() {
109-
return doctorByDoctorId;
111+
return doctor;
110112
}
111113

112-
public void setDoctorByDoctorId(Doctor doctorByDoctorId) {
113-
this.doctorByDoctorId = doctorByDoctorId;
114+
public void setDoctorByDoctorId(Doctor doctor) {
115+
this.doctor = doctor;
114116
}
115117
}

0 commit comments

Comments
 (0)