View Javadoc
1   package myorg.relex.one2one;
2   
3   import java.io.Serializable;
4   import java.util.Date;
5   
6   import javax.persistence.Embeddable;
7   
8   /**
9    * This class will be used as an IdClass for the ShowEvent
10   * entity.
11   */
12  @Embeddable
13  public class ShowEventPK implements Serializable {
14  	private static final long serialVersionUID = 1L;
15  	private Date date;
16  	private Date time;
17  	
18  	public ShowEventPK(){}
19  	public ShowEventPK(Date date, Date time) {
20  		this.date = date;
21  		this.time = time;
22  	}
23  	
24  	public Date getDate() { return date; }
25  	public Date getTime() { return time; }
26  	
27  	@Override
28  	public int hashCode() { return date.hashCode() + time.hashCode(); }
29  	@Override
30  	public boolean equals(Object obj) {
31  		try {
32  			if (this==obj) { return true; }
33  			return date.equals(((ShowEventPK)obj).date) &&
34  					time.equals(((ShowEventPK)obj).time);
35  		} catch (Exception ex) { return false; }
36  	}
37  }