DAO VS. SLSB

Discussions

EJB design: DAO VS. SLSB

  1. DAO VS. SLSB (1 messages)

    Hi.
    We are building a system with Swing clients and Enterprise Beans. One feature for the user is to use a functionkey ie. F7 to open a new window that shows all legit values for that field the curser was placed in.
    First design idea was to have a StateFull Session Bean (we have one alreadey as a facade) that created a StateLess Session Bean that read the database and return a RowSet.
    Second idea was to let the client call a Data Access Object, an ordinary JAVA class, that do the same database reading as the SLSB.

    Is there any differences to take into concern ?

    TIA

    Jan Nilsson

    Threaded Messages (1)

  2. DAO VS. SLSB[ Go to top ]


    Session Bean is mainly used to provide any entry into your Domain Model. If you want to seperate the business logic from the presentation layer, it is advisable to use Session Bean which provides an entry to your business domain. From SLSB you can write a SQL to get the values or use DAO to get the values. Thus your SLSB can talk to DAO which can get the values from the database. Thus in future if you want to talk to different Database/Vendor. There won't be much changes the way the data is retrieved from the SLSB to the UI. The only class which has SQL and data access will be DAO.

    Venket