• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Seat entity design

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Are we home yet? Wait, did we forget the tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic