Created
August 26, 2019 07:27
-
-
Save KiryhaPikoff/fa9672650ea93ed19d31180582aa4f5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.project.hospital.entity; | |
import lombok.AccessLevel; | |
import lombok.Data; | |
import lombok.experimental.FieldDefaults; | |
import javax.persistence.*; | |
@Data | |
@Entity | |
@Table(name = "card", schema = "hsptl") | |
@FieldDefaults(level=AccessLevel.PRIVATE) | |
public class Card { | |
@Id | |
@SequenceGenerator(name="card_id_seq", sequenceName="card_id_seq") | |
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="card_id_seq") | |
Integer id; | |
@Override | |
public int hashCode() { | |
return 100000000 + this.id; | |
} | |
@Override | |
public boolean equals(Object obj) { | |
if(obj == null) { | |
return false; | |
} | |
if(!(obj instanceof Card)) { | |
return false; | |
} | |
return this.id.equals( ( (Card) obj).getId() ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment