Entity beans


EJB design: Entity beans

  1. Entity beans (1 messages)

    I'm learning EJB and have a few questions. Pardon me if the questions don't make sense (It would be great though if can tell me why they don't make sense).

    Here are the questions:
    Q1: Will the container clean up an entity bean if it decides to put the bean back in the pool (may be because it wants to load some other data in the bean)?

    Q2: Why isn’t there a method called unsetSessionContext() in the SessionBean interface, like we have unsetEntityContext() in the EntityBean interface?

    Q3: Does it make sense to define our finder methods of an entity bean in a remote home interface? Or, for that matter, is it a good design choice to have only local interfaces for the all the entity beans and then have accessed by session beans, which are in turn accessed by the clients?

    Q4: Other side of question 3, is there any scenario where it is a good design choice to distribute your entity and session beans in different machines, as in a distributed computing environment, i.e., your entity beans running on a server in Texas, your session beans running on a server in California and you have clients accessing the entity beans through the session beans (not directly)?


    Threaded Messages (1)

  2. Entity beans[ Go to top ]


    Ans1) Your question is not completely correct. Each Enitity bean in pool maps to single record in table. You work on that record and when are not working it passivates it and if you add something it updates that record which in turn gets updated in database. When you say delete it deletes that record.

    Ans2) to give all the information of container or server to that bean...Its like giving all the information of pool, database connection to this entity bean. Then Bean can decide how to use it.

    Ans3) Remember a good design is to invoke your entity bean through Session Bean (wrap it under session bean).

    Ans4) I don`t think so....that should be the way. Load balancing is a different issue but you suggestion doesn`t help it anyway..