Entity Beans running in a managed server topology


EJB design: Entity Beans running in a managed server topology

  1. Hello,

    Hoping this is a basic question !

    We have a server topology running many managed instances (no cluster) and we want to deploy entity beans which will read and write information from the database.

    If a bean from a given manage server updates the information in the database, can i assume the other beans running in the other instances will be in sync with the updated data ?

    Same thing if the database is modified from an external application, will the state be reflected in an entity which might have already have the state in memory.

  2. Firstly the Entity beans will not have a state associated with it until the beans are requested by a client, see the life cycle of entity beans for more clarity. Entity beans will have the state available from the database only when they are in the ready state.

    Hope this helps.
  3. To add to what I have stated earlier, I think you also need to read the appserver documentation to go into the specifics of how each of the vendor has implemented it. ex: In case of weblogic server see how it works


    See the section. Understanding ejbLoad() and ejbStore() Behavior.

  4. Careful about deletes...[ Go to top ]

    Updates/inserts may be fine. But if your program has a reference to an EJB that points to data in the database and if an external program deletes off that row, then you can get weird exceptions like InstanceNotFound... Need to be careful when something like this is done.

    You should use the "Version # pattern" when you are using data transfer objects with entity beans, that will prevent missed updates.