1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.webflow.samples.booking;
20
21 import java.io.Serializable;
22 import java.math.BigDecimal;
23
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.Id;
28
29
30
31
32 @Entity
33 public class Hotel implements Serializable {
34 private Long id;
35
36 private String name;
37
38 private String address;
39
40 private String city;
41
42 private String state;
43
44 private String zip;
45
46 private String country;
47
48 private BigDecimal price;
49
50 @Id
51 @GeneratedValue
52 public Long getId() {
53 return id;
54 }
55
56 public void setId(Long id) {
57 this.id = id;
58 }
59
60 public String getName() {
61 return name;
62 }
63
64 public void setName(String name) {
65 this.name = name;
66 }
67
68 public String getAddress() {
69 return address;
70 }
71
72 public void setAddress(String address) {
73 this.address = address;
74 }
75
76 public String getCity() {
77 return city;
78 }
79
80 public void setCity(String city) {
81 this.city = city;
82 }
83
84 public String getZip() {
85 return zip;
86 }
87
88 public void setZip(String zip) {
89 this.zip = zip;
90 }
91
92 public String getState() {
93 return state;
94 }
95
96 public void setState(String state) {
97 this.state = state;
98 }
99
100 public String getCountry() {
101 return country;
102 }
103
104 public void setCountry(String country) {
105 this.country = country;
106 }
107
108 @Column(precision = 6, scale = 2)
109 public BigDecimal getPrice() {
110 return price;
111 }
112
113 public void setPrice(BigDecimal price) {
114 this.price = price;
115 }
116
117 public Booking createBooking(User user) {
118 return new Booking(this, user);
119 }
120
121 @Override
122 public String toString() {
123 return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
124 }
125 }