diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/BookingService.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/BookingService.java
index 5789c6f5..751d7535 100755
--- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/BookingService.java
+++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/BookingService.java
@@ -10,4 +10,5 @@ public interface BookingService {
public Hotel findHotelById(Long id);
+ public void cancelBooking(Long id);
}
diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/JpaBookingService.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/JpaBookingService.java
index 0ee6efa7..444a7be0 100755
--- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/JpaBookingService.java
+++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/app/JpaBookingService.java
@@ -41,4 +41,12 @@ public class JpaBookingService implements BookingService {
public Hotel findHotelById(Long id) {
return em.find(Hotel.class, id);
}
+
+ @Transactional
+ public void cancelBooking(Long id) {
+ Booking booking = em.find(Booking.class, id);
+ if (booking != null) {
+ em.remove(booking);
+ }
+ }
}
\ No newline at end of file
diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/booking/BookingActions.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/booking/BookingActions.java
index b1d67141..62550ee9 100644
--- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/booking/BookingActions.java
+++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/booking/BookingActions.java
@@ -17,7 +17,7 @@ public class BookingActions extends MultiAction {
public Event createBooking(RequestContext context) {
Hotel hotel = (Hotel) context.getFlowScope().get("hotel");
- User user = (User) context.getFlowScope().get("user");
+ User user = (User) context.getConversationScope().get("user");
Booking booking = new Booking(hotel, user);
EntityManager em = (EntityManager) context.getFlowScope().get("entityManager");
em.persist(booking);
diff --git a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/MainActions.java b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/MainActions.java
index 66a7a6c7..d4b5c852 100644
--- a/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/MainActions.java
+++ b/spring-webflow-samples/booking-jsf/src/main/java/org/springframework/webflow/samples/booking/flow/main/MainActions.java
@@ -39,9 +39,4 @@ public class MainActions extends MultiAction {
context.getFlowScope().put("hotels", new SerializableListDataModel(hotels));
return success();
}
-
- public Event removeBooking(RequestContext context) {
- return success();
- }
-
}
diff --git a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml
index f80a79ba..c6c24d7b 100755
--- a/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml
+++ b/spring-webflow-samples/booking-jsf/src/main/webapp/flow/main/main.xml
@@ -34,8 +34,12 @@
-
-
+
+
+
+
+
+