File tree Expand file tree Collapse file tree
src/main/java/org/launchcode/codingevents/models Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1313 * Created by Chris Bay
1414 */
1515@ Entity
16- public class Event extends AbstractEntity {
17-
16+ public class Event {
17+ @ Id
18+ @ GeneratedValue
19+ private int id ;
1820
1921 @ NotBlank (message = "Name is required" )
2022 @ Size (min = 3 , max = 50 , message = "Name must be between 3 and 50 characters" )
@@ -70,6 +72,27 @@ public void setType(EventType type) {
7072 this .type = type ;
7173 }
7274
75+ public int getId () {
76+ return id ;
77+ }
78+
79+ public void setId (int id ) {
80+ this .id = id ;
81+ }
82+
83+ @ Override
84+ public boolean equals (Object o ) {
85+ if (this == o ) return true ;
86+ if (o == null || getClass () != o .getClass ()) return false ;
87+ Event event = (Event ) o ;
88+ return id == event .id ;
89+ }
90+
91+ @ Override
92+ public int hashCode () {
93+ return Objects .hash (id );
94+ }
95+
7396 @ Override
7497 public String toString () {
7598 return name ;
Original file line number Diff line number Diff line change 88import java .util .Objects ;
99
1010@ Entity
11- public class EventCategory extends AbstractEntity {
11+ public class EventCategory {
12+
13+ @ Id
14+ @ GeneratedValue
15+ private int id ;
1216
1317
1418 @ Size (min =3 , message ="Name must be at least 3 characters long" )
@@ -28,11 +32,25 @@ public void setName(String name) {
2832 this .name = name ;
2933 }
3034
35+ public int getId () {
36+ return id ;
37+ }
3138
3239 @ Override
3340 public String toString () {
3441 return name ;
3542 }
3643
44+ @ Override
45+ public boolean equals (Object o ) {
46+ if (this == o ) return true ;
47+ if (o == null || getClass () != o .getClass ()) return false ;
48+ EventCategory that = (EventCategory ) o ;
49+ return id == that .id ;
50+ }
3751
52+ @ Override
53+ public int hashCode () {
54+ return Objects .hash (id );
55+ }
3856}
You can’t perform that action at this time.
0 commit comments