Class JPAHotelDAO
- java.lang.Object
-
- info.ejava.examples.ejb.ejbjpa.dao.JPAHotelDAO
-
-
Field Summary
Fields Modifier and Type Field Description private EntityManager
em
-
Constructor Summary
Constructors Constructor Description JPAHotelDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFloor(Floor floor)
void
addGuest(Guest guest)
void
clearAll()
Floor
fetchFloor(int level)
Room
findRoomByGuest(Guest guest)
List<Room>
getAvailableRooms(Integer level, int offset, int limit)
List<Room>
getAvailableRoomsForUpdate(Integer level, int offset, int limit)
protected TypedQuery<Room>
getAvailableRoomsQuery(Integer level, int offset, int limit)
Floor
getFloor(int level)
List<Floor>
getFloors(int offset, int limit)
Room
getRoom(int number)
void
populate()
void
setEntityManager(EntityManager em)
private <T> TypedQuery<T>
withPaging(TypedQuery<T> query, int offset, int limit)
-
-
-
Field Detail
-
em
private EntityManager em
-
-
Method Detail
-
setEntityManager
public void setEntityManager(EntityManager em)
-
withPaging
private <T> TypedQuery<T> withPaging(TypedQuery<T> query, int offset, int limit)
-
fetchFloor
public Floor fetchFloor(int level)
- Specified by:
fetchFloor
in interfaceHotelDAO
-
getAvailableRoomsQuery
protected TypedQuery<Room> getAvailableRoomsQuery(Integer level, int offset, int limit)
-
getAvailableRooms
public List<Room> getAvailableRooms(Integer level, int offset, int limit)
- Specified by:
getAvailableRooms
in interfaceHotelDAO
-
getAvailableRoomsForUpdate
public List<Room> getAvailableRoomsForUpdate(Integer level, int offset, int limit)
- Specified by:
getAvailableRoomsForUpdate
in interfaceHotelDAO
-
findRoomByGuest
public Room findRoomByGuest(Guest guest)
- Specified by:
findRoomByGuest
in interfaceHotelDAO
-
-