1 package org.hibernate.test.annotations.onetoone; 3 4 import javax.persistence.Embeddable; 5 import java.io.Serializable ; 6 7 10 @Embeddable 11 public class ComputerPk implements Serializable { 12 private String brand; 13 private String model; 14 15 public boolean equals(Object o) { 16 if (this == o) return true; 17 if (!(o instanceof ComputerPk)) return false; 18 19 final ComputerPk computerPk = (ComputerPk) o; 20 21 if (!brand.equals(computerPk.brand)) return false; 22 if (!model.equals(computerPk.model)) return false; 23 24 return true; 25 } 26 27 public int hashCode() { 28 int result; 29 result = brand.hashCode(); 30 result = 29 * result + model.hashCode(); 31 return result; 32 } 33 34 public String getBrand() { 35 return brand; 36 } 37 38 public void setBrand(String brand) { 39 this.brand = brand; 40 } 41 42 public String getModel() { 43 return model; 44 } 45 46 public void setModel(String model) { 47 this.model = model; 48 } 49 } 50 | Popular Tags |