Modelling an object as Session Bean or Entity Bean ?

F

Francesco

Hi all !
I'm modelling an application for selling tickets on-line.
Tickets are booked on-line then the user navigates to the payment page
and pays with credit card.

The business analyst decided to allow a 30 minutes reservation time for
people who booked the ticket to pay with credit card.

If time elapses the seat "lock" is released.

I think there should be an EJB responsible to keep up with Seat
reservations.

My dilemma is : should I model it as Session Bean or Entity Bean ?
I initially modelled it as Session Bean with plain (Insert/Update) of
the Seats Table when the ticket is booked / paid / time elapsed

On the other hand I think, if there's multi-user access of the PK
(SeatId),
an Entity Bean should be used.

What do you say to it ? Session Bean or Entity Bean ?
Thanks in advance
Francesco
 
W

wesley.hall

Francesco said:
Hi all !
I'm modelling an application for selling tickets on-line.
Tickets are booked on-line then the user navigates to the payment page
and pays with credit card.

The business analyst decided to allow a 30 minutes reservation time for
people who booked the ticket to pay with credit card.

If time elapses the seat "lock" is released.

I think there should be an EJB responsible to keep up with Seat
reservations.

My dilemma is : should I model it as Session Bean or Entity Bean ?
I initially modelled it as Session Bean with plain (Insert/Update) of
the Seats Table when the ticket is booked / paid / time elapsed

On the other hand I think, if there's multi-user access of the PK
(SeatId),
an Entity Bean should be used.

What do you say to it ? Session Bean or Entity Bean ?
Thanks in advance
Francesco

It should be an entity bean.
 
D

Danno

Francesco said:
Hi all !
I'm modelling an application for selling tickets on-line.
Tickets are booked on-line then the user navigates to the payment page
and pays with credit card.

The business analyst decided to allow a 30 minutes reservation time for
people who booked the ticket to pay with credit card.

If time elapses the seat "lock" is released.

I think there should be an EJB responsible to keep up with Seat
reservations.

My dilemma is : should I model it as Session Bean or Entity Bean ?
I initially modelled it as Session Bean with plain (Insert/Update) of
the Seats Table when the ticket is booked / paid / time elapsed

On the other hand I think, if there's multi-user access of the PK
(SeatId),
an Entity Bean should be used.

What do you say to it ? Session Bean or Entity Bean ?
Thanks in advance
Francesco

Wesley is correct, the ticket should be an entity bean. I just want to
also mention that session beans are verbs (reserveTicket, buyTicket,
surrenderTicket, isAvailable) and entity beans are nouns (customer,
ticket, creditCard, address).
 
W

wesley.hall

Wesley is correct, the ticket should be an entity bean. I just want to
also mention that session beans are verbs (reserveTicket, buyTicket,
surrenderTicket, isAvailable) and entity beans are nouns (customer,
ticket, creditCard, address).

Danno,

I feel really bad disagreeing with you after you so nicely called me
'correct' but disagree I must :)

While I see where you are coming from, it can be dangerous to think in
this way. Firstly, every item in your list of 'session beans' would not
be a bean in it's own right, just a method on a bean.

Your examples of entitities are OK, but it is not correct to say
'entity beans are nouns'. What about ShoppingCart? This is a noun, but
I certainly wouldn't fault anyone for implementing it at a stateful
session bean (infact, I would have a few questions if they used an
entity).

If you want a general rule to follow, then yes generally nouns are
usually modelled as entities (but certainly not all nouns).

A general rule for session beans is much harder to pin down, they might
also be nouns (ShoppingCart) or roles (BookingAgent), or just a generic
collection of related functions (LogHandler).

The only real rule you can follow is... "Session beans hold no state or
state private to the user (stateless/stateful) and do not support
concurrency. Entity beans hold shared state and are fully concurrent".
 

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top