Discussions

EJB design: Restrictions for accessing EJB instances

  1. Restrictions for accessing EJB instances (2 messages)

    I have read weblogic documentation and found that "Entity EJBs can be accessed by multiple clients, but only in a serial fashion.(an instance having the same primary key), the second client blocks until the EJB is available."

    Is there any way I can avoid this and give access to two clients simultaneous access to that entity( I dont mind creating 2 remote interfaces ie. calling find by primarykey twice for same entity).
    Puru
  2. Restrictions for accessing EJB instances[ Go to top ]

    Puru:

        Every entity bean holds a single record of the attached table. That is why when one entity bean is in transaction and is holding a record through Primary Key, users are not allowed to have another instance of bean with same PK. This is very true from DB point of view too, as the updates and deletion of the row will take the row in mutation and will not allow other connections to change the data till it is out of transaction.

        If you want to fire multiple row update query then try to use simple sql with preparedStatement syntax.

    Hope thhis helps
    Regards
    Chetan
  3. You can have multiple instances[ Go to top ]

    For an Entity Bean, you can configure it to have only one instance (exclusive) or multiple instances. Clients accessing the same instance need to wait. But nothing prevents the container to give another client another instance if it is not configured to be exclusive.

    With clustering, you could have multiple instances in a cluster.