-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
Umbrella.java
82 lines (66 loc) · 1.39 KB
/
Umbrella.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package org.hibernate.ejb.test.util;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Umbrella {
private PK id;
private int size;
@EmbeddedId
public PK getId() {
return id;
}
public void setId(PK id) {
this.id = id;
}
@Column(name="fld_size")
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public static class PK implements Serializable {
private String model;
private String brand;
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
@Override
public boolean equals(Object o) {
if ( this == o ) {
return true;
}
if ( o == null || getClass() != o.getClass() ) {
return false;
}
PK pk = ( PK ) o;
if ( brand != null ? !brand.equals( pk.brand ) : pk.brand != null ) {
return false;
}
if ( model != null ? !model.equals( pk.model ) : pk.model != null ) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = model != null ? model.hashCode() : 0;
result = 31 * result + ( brand != null ? brand.hashCode() : 0 );
return result;
}
}
}