package com.gitrekt.resort.model.entities;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

@Entity
public class Room {
    
    @Id
    private String roomNumber;
    
    @ManyToOne(cascade = CascadeType.ALL)
    private RoomCategory roomCategory;
    
    /**
     * DO NOT CALL THIS CONSTRUCTOR. IT EXISTS ONLY BECAUSE IT IS REQUIRED BY
     * HIBERNATE.
     */
    Room() {
        // REQUIRED BY HIBERNATE
    }
    
    public Room(String roomNumber, RoomCategory roomCategory) {
        this.roomNumber = roomNumber;
        this.roomCategory = roomCategory;
    }
    
    public String getRoomNumber() {
        return roomNumber;
    }
    
    public RoomCategory getRoomCategory() {
        return roomCategory;
    }
    
}

@@ -37,16 +37,42 @@
 ities;%0A%0A
+import java.util.Objects;%0A
 import j
@@ -101,16 +101,16 @@
 deType;%0A
-
 import j
@@ -228,21 +228,17 @@
  Room %7B%0A
-    
 %0A
+
     @Id%0A
@@ -268,21 +268,17 @@
 Number;%0A
-    
 %0A
+
     @Man
@@ -350,21 +350,17 @@
 tegory;%0A
-    
 %0A
+
     /**%0A
@@ -511,29 +511,25 @@
 RNATE%0A    %7D%0A
-    
 %0A
+
     public R
@@ -658,37 +658,33 @@
 Category;%0A    %7D%0A
-    
 %0A
+
     public Strin
@@ -736,21 +736,17 @@
 ;%0A    %7D%0A
-    
 %0A
+
     publ
@@ -816,15 +816,758 @@
 ;%0A    %7D%0A
+%0A
     
+@Override%0A    public int hashCode() %7B%0A        int hash = 7;%0A        hash = 17 * hash + Objects.hashCode(this.roomNumber);%0A        hash = 17 * hash + Objects.hashCode(this.roomCategory);%0A        return hash;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        if(this == obj) %7B%0A            return true;%0A        %7D%0A        if(obj == null) %7B%0A            return false;%0A        %7D%0A        if(getClass() != obj.getClass()) %7B%0A            return false;%0A        %7D%0A        final Room other = (Room) obj;%0A        if(!Objects.equals(this.roomNumber, other.roomNumber)) %7B%0A            return false;%0A        %7D%0A        if(!Objects.equals(this.roomCategory, other.roomCategory)) %7B%0A            return false;%0A        %7D%0A        return true;%0A    %7D%0A
 %0A%7D%0A

Implement hashCode and equals for Room