Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seat entity design

 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is concerning a subset of sequence diagram: how to what seat types are available (window, aisle, 1st class, coach class), and how to book a seat for a given flight.

Two tables are involved and I use entity bena (since it requires us to use J2EE.)

table A: Flight, Plane, Plane Type
so that with any given flight, I know the plane it is assigned. Say, for flight 123, it is assigned to a Boeing 737.

There are several table in the following SEAT_PLAN structure, one for each plane type. The reason I use several tables as oppose to one big table is to distribute the load, so that the 600 users do not hit the same table.

Say, the following is BOEING737_SEATPLAN: (so that only flights assigned to a Boeing 737 interact with this table, thus distribute the load)

FlightNumber, SeatNumber, Reserved, SeatType

This structure allows user to query if certain seat type (window, aisle, 1st class, coach) is still available for a given flight in EJB-QL:

SELECT DISTINCT SEATTYPE FROM BOEING737_SEATPLAN WHERE FLIGHT_NUMBER = ?1 AND RESERVED = 'N'.

My problem comes in when I want to book a seat. Since the requirement says we must use J2EE, so I need to use entity bean. But with EJB-QL, it returns a list of seats to book (I do not think there is a way to return one object that satisfying the criteria):

SELECT Object FROM BOEING737_SEATPLAN WHERE FLIGHT_NUMBER = ?1 AND SEAT_TYPE = ?2 AND RESERVED = 'N'.

This returns a list of Seat object, but I only need one. Of course, I could randomly pick one from the list, and call object.Reserved(true) to update the RESERVED column to true. But that sounds like a little overkill.

Any comment?
Thanks,
Yan
 
Shabbir Kothawala
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow .. You are coding the solution..

I will use a combination of session and entity bean. There are 2 task involved

1) Getting the list of available seat so that you can give user a choice to select
2)Once the seat is selected then updating the same in your seat tables..

Thanks,
Shabbir
 
Pham Huy Anh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a concern about the seats.

Do we need to specify the relationship between Segment and Seat directly? Because, we have seat class and seat number for each Segment.

In the contrary, the indirect connection is : Segment --> Flight --> Equip --> (n) Seat.

Thanks,
[ June 22, 2007: Message edited by: Pham Huy Anh ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic