Discussions

EJB design: Can some explain this a bit

  1. Can some explain this a bit (5 messages)

    Hello All, in Mastring_EJB2 from serverside, at one place author explain the roles of session bean and entity beans which will confuse me a bit i-e.

    For Session Bean: an enterprise bean class typically contains business process related logic, such as logic to compute prices, tranfer funds between bank accounts or perform the order entry.

    For Entity Bean : an enterprice bean typically contains data related logic such as logic to change the name of customer,reduce the balance of a bank account or modify a purchase order.

    Now i am confuse at one point that what is the major difference b/w session and entity bean if session bean is handling transfer funds b/w basnk accounts then it can also reduce the balance of bank account or modify the purchase order.

    thaks in advance....
    with best regards....
    Raheel

    Threaded Messages (5)

  2. Can some explain this a bit[ Go to top ]

    Raheel:

      Just few helping pointer.

      Entity beans are object representation of a row in DB table.
    with this said, when u want to update, insert, delete row attribute, you will have to act of the representative objects so as to replicate the change in DB table. so when Sir roman says that put customer name change logic in entity bean that means that down the line u need to fire a update query on database.

       Session Beans are not attached to DB tables, that way you have them for putting in business logic. something like money transfer from one account to another. now in this transaction u have two entity beans which are representing two different accounts and later u do the "Business Logic part" of money transfer in ur session bean.

    hope this helps
    Regards
    Chetan
  3. Thanks Chetan[ Go to top ]

    Thanks Chetan once again :o) it will give me some idea may be i am right i-e put your all logic in session beans and when you need to do any transaction in DB call the entity bean which will do the transaction upon the values it get from your session bean i-e give the entity bean information of account number 1, 2 and the amount and the rest of the updation will be done by entity bean which you define if this is what i am thinking then i think i got the basic differnciate idea of the beans...

    :o)

    Thanks............
    with best regards...
    Raheel
  4. Can some explain this a bit[ Go to top ]

    Hi,

    in few and simple words:

    - Entity Beans deals with data.
    - Session Beans deals with processes (or use cases).
  5. Session&Entity[ Go to top ]

    Dear Raheel,
                 Yes your question is correct.ok we will take the example as u said.Session bean does the
    transactional work such as transferring funds for accounts etc....But if the server clashes(means having accounts details) then you cant retrieve the data if u manipulate with Sessing bean.

    But even if the server clashes,Entity bean will have all the account detalis in its memory.That is
    Entity bean is persistent.If u have any doubt pls dont hesistate to contact me
    My id is balu_subbiah@yahoo.com
  6. Thanks Balu and on thing more..[ Go to top ]

    Dear Balu,
             Thanks for your reply but i am little confused by this, that what that mean of server clashes and when server clash occur and if it happen the why use session bean if it can't menuplate this.

    the other thing in my mind for that i am very much confused is as following i will relly appriciate if you give me idea on that.

    Client who have 30 outlets (sell points) in the field of pharmasutical accross the country need to manage its inventory and account, so that he can see any time about the inventory reports and accounts, that what item need to send to which outlet where inventory level is down of that perticuler item.

    i am planning to this job in J2EE and by using EJB's but the main problem i am facing is the best network approach, T1 lines are not here, we have other standard that is ISDN with 64K and 128K channels, now i need some suggestion and feedbacks from you guys who have implementaion and practical experiane in that type of solutions where different branches need to connect with one centerlized place, and transaction ratio of some key points are normally 30 transaction / minutes, i-e customers rush on the shops normally the shops in the Hospitals.

    now i am a bit confused because i have never any practical experiance in this sort of solution, the point in my mind is that for example if the centerlized server location is in different city then what about the transaction speed,normally the shops where inventory/accounts software were running is done simple transaction very fast because of no remote call and no network isssue, then where is that solution stand which is in my mind, i am not clear in that and one thing more is that solutions capable of running on simple dialup lines?

    i will be very thank full to you all for considring and giving your time on that.

    with best regards...
    Raheel