Discussions

EJB design: Business methods are called,and ejbLoad,ejbStore are called?

  1. Hi all
      In Enitity Bean,when any business method is called,
    the container will call ejbLoad and ejbStore,is it right?
    if the business method is not data access in Entity bean
    ,container still call ejbLoad and ejbStore ?
    if it's so,it will make network heavy traffic,
    if i use a session bean to access data by JDBC when i want to access database,
    then why use Entity Bean? which good???
  2. hi
    you can restrict call to load and store by setting the
    deployment descriptor,is-db-shared and is-modified-method-name,

    and advantages of entity are multiple clients can acess the entity concurrently,
    session bean use db call for every request where as entity
    will cache your data in middle tier.

    hope u got it,
    bye
    rk.
  3. Hi
      thanks your reply the message! I can understand
    the entity Bean catch data,but another Q is why define
    the value object in Entity Bean?

    and the "advantages of entity are multiple clients
    can acess the entity concurrently",

    All business methods in Entity Bean and Session Bean
     are called serializable ,is it right? if it is so
    then what is "multiple clients can acess the
    entity concurrently"
          Thanks
  4. hi ,

    you use value objects for bulk access of data to optimize performance,
    that is all the passed to client with one remote call.

    coming to concurrent acess
    There can be more than one entity representing the same data and updating the database is locked by the isolation level opted.
    Thus many users can access data with their own copies.


    bye
    Ravi.
  5. Hi ravi kiran
      thanks for your reply,it is ok! i can understand
    "There can be more than one entity representing
    the same data",the container will guarantee the data
    is same,Is it?

    then i want to ask another Q: if the statless
    session Bean also has more than one instance like
    Entity Bean?
  6. hi alix,
    yes container will guarante that there is no data inconsistancies,

    but coming to state less session bean its different because each client has one instance which is same like any other instance but there wont be any caching ,
    that is every get and set need data access.

    bye
    rk.
  7. Hi ravi kiran
       Thanks very much for your reply and every message
    is in time. Maybe i dont express clearly for stateless session bean.
      if there are many many clients call a stateless
    session Bean at the same time,the container only use
    one stateless bean instance to serialize all clients
    call (one by one) or there are many the same Bean
    instance in container to response every client at the same
    time?
       I have another Q(sorry so many Q):How to choice
    Entity Bean and stateless Session bean for db access?
       if i want to do a bulk database query(100000 rows or
    more),i should use a Entity Bean finder method or write
    a stateless session bean for the big database table
    (JDBC executeQuery),or write a common stateless session
    bean to do all db table select,ex:
    Vector query(String sql)

    which one should i choice?
    thanks!