To use an entity bean or just put JDBC code in Session Bean?


EJB programming & troubleshooting: To use an entity bean or just put JDBC code in Session Bean?

  1. When I write database access stuff. When would you rather than put it in an entity bean, put it in JDBC code called from the session bean.

  2. Hi Nick
    Use session bean when
    :- when u want bulk of data from database abd this is data is not shared between concurrent clients and complex transaction is not invloved with this data tables

    Go for Entity Bean when :
    Data is shared among the lot os concurrent clients and comllext transaction is invlolved one must go for the enity bean never use entity bean only for bulk of data retrival

    i hope this will solve u r purpose
    free feel to talk to me on
    s dot manoj at zensar dot com

    Manoj Sharma

  3. Cheers.

    So does that mean basically for SELECTS of data, where no updates are occurring, such as for static data?

  4. yes most of the time this is true !!
    example when u just want to get chunk od data
    only to present to the client end so go for seeion beans
    if u r writing entity bean here overhead will be more

  5. I've also read that that using data value objects talking to an entity bean whould be good for this type of use. Would this be better, so all db code is then encapsulated in entity beans.

    What do you thank?
  6. yes nick u r right !!
    a good solution
    generally we preffer to use facade design pattern

  7. Cheers 4 help.
  8. cheers :))