public class HotelRegistrationEJB extends Object implements HotelRegistrationRemote, HotelRegistrationLocal
| Modifier and Type | Field and Description |
|---|---|
private SessionContext |
ctx |
private EntityManager |
em |
private org.apache.commons.logging.Log |
log |
private HotelReservationist |
reservationist |
| Constructor and Description |
|---|
HotelRegistrationEJB() |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelReservation(Reservation reservation)
This method will cause the current transaction to be rolled back
if the business logic reports an exception cancelling a reservation.
|
void |
cleanupReservation(String confirmation) |
void |
close()
This method is called whenever the EJB is evicted from the container;
which is not too often for stateless session beans under normal
circumstances.
|
Reservation |
commitReservation(Reservation reservation)
This method is just a pass-thru to the business logic.
|
Reservation |
createReservation(Person person,
Date startDate,
Date endDate)
This method will rollack the current transaction if the business
logic throws an exception while trying to create a reservation.
|
Reservation |
getReservationByConfirmation(String confirmation) |
List<Reservation> |
getReservations(int index,
int count) |
List<Reservation> |
getReservationsForPerson(Person person,
int index,
int count) |
void |
init()
This method is called when the bean is created and is responsble for
instantiating the business logic implementation, a DAO, and assigning
the EntityManager for the DAO(s) to use.
|
private org.apache.commons.logging.Log log
private EntityManager em
private SessionContext ctx
private HotelReservationist reservationist
@PostConstruct public void init()
@PreDestroy public void close()
public void cancelReservation(Reservation reservation) throws HotelReservationException
cancelReservation in interface HotelReservationistHotelReservationExceptionpublic Reservation commitReservation(Reservation reservation) throws HotelReservationException
commitReservation in interface HotelReservationistHotelReservationExceptionpublic Reservation createReservation(Person person, Date startDate, Date endDate) throws HotelReservationException
createReservation in interface HotelReservationistHotelReservationExceptionpublic List<Reservation> getReservations(int index, int count) throws HotelReservationException
getReservations in interface HotelReservationistHotelReservationExceptionpublic List<Reservation> getReservationsForPerson(Person person, int index, int count) throws HotelReservationException
getReservationsForPerson in interface HotelReservationistHotelReservationExceptionpublic Reservation getReservationByConfirmation(String confirmation) throws HotelReservationException
getReservationByConfirmation in interface HotelReservationistHotelReservationExceptionpublic void cleanupReservation(String confirmation) throws HotelReservationException
cleanupReservation in interface HotelReservationistHotelReservationExceptionCopyright © 2015 John's Hopkins University, Engineering Programs for Professionals. All rights reserved.