Page History
...
Code Block | ||||
---|---|---|---|---|
| ||||
import javax.persistence.Column; import javax.persistence.Embeddable; @Embeddable public class ItemId implements Serializable { @Column(columnDefinition="char(71)") //특수데이터 데이터 Type 변환방법 char(1) -> string private String itemtype; private int itemno; public ItemId() { } public ItemId(String itemtype, int itemno) { this.itemtype = itemtype; this.itemno = itemno; } @Override public int hashCode() { final int prime = 31; int result = 1; result = itemtype.hashCode() + itemno; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ItemId other = (ItemId) obj; if (itemtype == null) { if (other.itemtype != null) return false; } else if (!itemtype.equals(other.itemtype)) return false; if (itemno != other.itemno) return false; return true; } public String getItemtype() { return itemtype; } public void setItemtype(String itemtype) { this.itemtype = itemtype; } public int getItemno() { return itemno; } public void setItemno(int itemno) { this.itemno = itemno; } } |
...