File tree Expand file tree Collapse file tree
src/main/java/com/gabriel_torelo/game_list/entities Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .gabriel_torelo .game_list .entities ;
2+
3+ import jakarta .persistence .EmbeddedId ;
4+ import jakarta .persistence .Entity ;
5+ import jakarta .persistence .Table ;
6+
7+ @ Entity
8+ @ Table (name = "tb_belonging" )
9+ public class Belonging {
10+
11+ @ EmbeddedId
12+ private BelongingPK id = new BelongingPK ();
13+ private Integer position ;
14+
15+ public Belonging () {
16+ }
17+
18+ public Belonging (Game game , GameList list , Integer position ) {
19+ id .setGame (game );
20+ id .setGameList (list );
21+ this .position = position ;
22+ }
23+
24+ public BelongingPK getId () {
25+ return id ;
26+ }
27+
28+ public void setId (BelongingPK id ) {
29+ this .id = id ;
30+ }
31+
32+ public Integer getPosition () {
33+ return position ;
34+ }
35+
36+ public void setPosition (Integer position ) {
37+ this .position = position ;
38+ }
39+
40+ @ Override
41+ public int hashCode () {
42+ final int prime = 31 ;
43+ int result = 1 ;
44+ result = prime * result + ((id == null ) ? 0 : id .hashCode ());
45+ return result ;
46+ }
47+
48+ @ Override
49+ public boolean equals (Object obj ) {
50+ if (this == obj )
51+ return true ;
52+ if (obj == null )
53+ return false ;
54+ if (getClass () != obj .getClass ())
55+ return false ;
56+ Belonging other = (Belonging ) obj ;
57+ if (id == null ) {
58+ if (other .id != null )
59+ return false ;
60+ } else if (!id .equals (other .id ))
61+ return false ;
62+ return true ;
63+ }
64+ }
You can’t perform that action at this time.
0 commit comments