View Javadoc
1   package ejava.jpa.examples.tuning.bo;
2   
3   import java.io.Serializable;
4   
5   public class MovieRolePK implements Serializable {
6   	private static final long serialVersionUID = -2134263902401216090L;
7   	private String movie;
8   	private String role;
9   	
10  	public MovieRolePK() {}
11  	
12  	public String getMovie() { return movie; }
13  	public MovieRolePK setMovie(String movie) {
14  		this.movie = movie;
15  		return this;
16  	}
17  	
18  	public String getRole() { return role; }
19  	public MovieRolePK setRole(String role) {
20  		this.role = role;
21  		return this;
22  	}
23  
24  	@Override
25  	public int hashCode() {
26  		return movie==null?0:movie.hashCode() +
27  				role==null?0:role.hashCode();
28  	}
29  	
30  	@Override
31  	public boolean equals(Object obj) {
32  		try {
33  			if (this==obj) { return true; }
34  			if (obj==null) { return false; }
35  			MovieRolePK rhs = (MovieRolePK)obj;
36  			if (movie!=null && role!=null) {
37  				return movie.equals(rhs.movie) && role.equals(rhs.role);
38  			}
39  			if (movie==null && rhs.movie!=null) { return false; }
40  			if (role==null && rhs.role!=null) { return false; }
41  			return true;
42  		} catch (Exception ex) { return false; }
43  	}
44  	
45  	@Override
46  	public String toString() {
47  		return movie + " " + role;
48  	}
49  	
50  }