Parcourir la source

started part 1

Keith Brinker il y a 8 ans
Parent
révision
e9d8964145

+ 35
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/io/zipcode/tc_spring_poll_application/domain/Option.java Voir le fichier

@@ -0,0 +1,35 @@
1
+package io.zipcoder.tc_spring_poll_application.io.zipcode.tc_spring_poll_application.domain;
2
+
3
+import javax.persistence.Column;
4
+import javax.persistence.Entity;
5
+import javax.persistence.GeneratedValue;
6
+import javax.persistence.Id;
7
+
8
+@Entity
9
+public class Option {
10
+    @Id
11
+    @GeneratedValue
12
+    @Column(name  = "OPTION_ID")
13
+            Long id;
14
+
15
+    @Column(name = "OPTION_VALUE")
16
+            String value;
17
+
18
+
19
+    public Long getId() {
20
+        return id;
21
+    }
22
+
23
+    public void setId(long id) {
24
+        this.id = id;
25
+    }
26
+
27
+    public String getValue() {
28
+        return value;
29
+    }
30
+
31
+    public void setValue(String value) {
32
+        this.value = value;
33
+    }
34
+
35
+}

+ 48
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/io/zipcode/tc_spring_poll_application/domain/Poll.java Voir le fichier

@@ -0,0 +1,48 @@
1
+package io.zipcoder.tc_spring_poll_application.io.zipcode.tc_spring_poll_application.domain;
2
+
3
+import javax.persistence.*;
4
+import java.util.Set;
5
+
6
+@Entity
7
+public class Poll {
8
+
9
+        @Id
10
+        @GeneratedValue
11
+        @Column(name  = "POLL_ID")
12
+        long id;
13
+
14
+        @Column(name = "QUESTION")
15
+        String question;
16
+
17
+
18
+        @OneToMany(cascade = CascadeType.ALL)
19
+        @JoinColumn(name = "POLL_ID")
20
+        @OrderBy
21
+        Set<Option> option;
22
+
23
+    public long getId() {
24
+        return id;
25
+    }
26
+
27
+    public void setId(long id) {
28
+        this.id = id;
29
+    }
30
+
31
+    public String getQuestion() {
32
+        return question;
33
+    }
34
+
35
+    public void setQuestion(String question) {
36
+        this.question = question;
37
+    }
38
+
39
+    public Set<Option> getOption() {
40
+        return option;
41
+    }
42
+
43
+    public void setOption(Set<Option> option) {
44
+        this.option = option;
45
+    }
46
+}
47
+
48
+

+ 17
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/io/zipcode/tc_spring_poll_application/domain/Vote.java Voir le fichier

@@ -0,0 +1,17 @@
1
+package io.zipcoder.tc_spring_poll_application.io.zipcode.tc_spring_poll_application.domain;
2
+
3
+
4
+import javax.persistence.Column;
5
+import javax.persistence.Entity;
6
+import javax.persistence.GeneratedValue;
7
+import javax.persistence.Id;
8
+
9
+@Entity
10
+public class Vote {
11
+
12
+    @Id
13
+    @GeneratedValue
14
+    @Column(name = "VOTE_ID")
15
+    Long id;
16
+
17
+}