Sfoglia il codice sorgente

Made Option class and tarted Poll class

CWinarski 8 anni fa
parent
commit
b599574cd0

+ 35
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/domain/Option.java Vedi File

1
+package io.zipcoder.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 // this means that a class can be mapped to a table. Just is a marker like Serializable
9
+public class Option {
10
+
11
+    @Id // specifies primary key of entity
12
+    @GeneratedValue // configures the way of increment of the specified column (field)
13
+    @Column(name = "OPTION_ID")// specifies mapped column for a persisitence property. Without this annotation the framework assumes the field's variable-name is the persistent property
14
+    private long id;
15
+
16
+    @Column(name = "OPTION_VALUE")// specifies mapped column for persistence value
17
+    private String value;
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
+}

+ 4
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/domain/Poll.java Vedi File

1
+package io.zipcoder.tc_spring_poll_application.domain;
2
+
3
+public class Poll {
4
+}