1 package net.sf.r4h.model; 2 3 import java.util.ArrayList; 4 import java.util.Date; 5 import java.util.List; 6 7 import javax.persistence.CascadeType; 8 import javax.persistence.Entity; 9 import javax.persistence.OneToMany; 10 import javax.persistence.Table; 11 12 @Entity 13 @Table( name = "ITEMS" ) 14 public class Item extends BaseEntity { 15 16 private Date time; 17 18 public Date getTime() { 19 return time; 20 } 21 22 public void setTime(Date time) { 23 this.time = time; 24 } 25 26 @OneToMany( cascade = CascadeType.ALL, mappedBy = "item" ) 27 private List<Bid> bids = new ArrayList<Bid>(); 28 29 public List<Bid> getBids() { 30 return bids; 31 } 32 33 public void setBids( List<Bid> bids ) { 34 this.bids = bids; 35 } 36 37 @Override 38 public int hashCode() { 39 final int prime = 31; 40 int result = super.hashCode(); 41 result = prime * result + ((time == null) ? 0 : time.hashCode()); 42 return result; 43 } 44 45 @Override 46 public boolean equals(Object obj) { 47 if (this == obj) 48 return true; 49 if (!super.equals(obj)) 50 return false; 51 if (getClass() != obj.getClass()) 52 return false; 53 Item other = (Item) obj; 54 if (time == null) { 55 if (other.time != null) 56 return false; 57 } else if (!time.equals(other.time)) 58 return false; 59 return true; 60 } 61 62 @Override 63 public String toString() { 64 return super.toString() + "Item [time=" + time + ", bids=" + bids + "]"; 65 } 66 67 }