The difference between Session and Entity Beans? <see body>

Discussions

EJB programming & troubleshooting: The difference between Session and Entity Beans? <see body>

  1. I know the way Session and Entity beans work. And I know the difference between stateless and stateful Session Beans. In terms of applications, a few examples I found and have been looking over the code they pretty much were doing the same thing and didn’t seem to take advantage of one or the other bean type. It was an account application, dealing with stocks. Maybe just a bad example, but does anyone mind sharing their thoughts and maybe examples (no code needed) of when they would use one over the other. Thanks.
  2. Hi Kabal,
    Usually in a typical example, the session bean is the entry point of ur application from the client side of from the servlet[jsp].

    It will have business methods and these methods will internally make a call to the finder methods of the entity beans to retreive the information from the data base as we know that the entity bean is the one that persists with the data.

    So ur business logic and decision making work flow should be used in a session bean and all the database related operations should go into entity bean.

    This is at the very basic level. For more optimization u can used design patterns.


    I hope this helps.

    Regards
    Nagendra Prasad
  3. In the book "Mastering EJB" (pg.29), examples given for session and entity bean goes below:

    ENTITY SESSION
    Bank Teller Bank Account
    Credit Card Authroizer Credit Card
    DNA Sequencer DNA Strand
    Order Entry System Order, Line Item
    Catalog Engine Product
    Auction Broker Bid, Item
    Purchase Order Approval Router Purchase Order

    Is it right? I feel it should be reverse.

    Thanks
    Joy
    joyatbics@yahoo.com
  4. Entity and session bean examples[ Go to top ]

    Better presentation goes below:-

    ENTITY - SESSION
    Bank Teller - Bank Account
    Credit Card Authroizer - Credit Card
    DNA Sequencer - DNA Strand
    Order Entry System - Order, Line Item
    Catalog Engine - Product
    Auction Broker - Bid, Item
    Purchase Order Approval Router - Purchase Order
  5. entity and session beans[ Go to top ]

    Session beans are good for businnes logic and entity beans are good for retrieving data plus,insertions and updations of data
  6. When with the session bean, we can do database operations, why is the need for a different kind of bean called Entity bean.
    An entity bean represents a data [row]in a database. A session bean can also have an object which represents the same..

    Other than persistence services provided by entity beans are there any advantages of using them??
  7. Entity Beans are shared, where as Sessoin Beans are synchronized.