Reference to the Home Object

Discussions

Performance and scalability: Reference to the Home Object

  1. Reference to the Home Object (9 messages)

    Hello, Gurus.

    Here is the my situation. I am developing a stateless sessions that references to many entity beans. In each remote methods, I was looking for these entity beas by jndi look up... Of course, I had to get the InitialContext, and all that.. But, my particular question is whether it's a good idea to put the home reference of these entity beans as the private field in the stateless session bean or not. These home references are not going to change, and looking up these home reference every time doesn't seem like a good idea for performance reason.

    Is there any reasons why one should put the codes that look up the entity bean home reference in each method call? or is it better to put them in setSessionContext method, and use them in every method call?

    Any suggestions and help is appreciated. THanks.

    Threaded Messages (9)

  2. Reference to the Home Object[ Go to top ]

    I tried doing the same, everything worked fine but when I tried to update the deployed bean at runtime, the home object reference could not be used anymore....

    Though according to the EJB spec, the container should not update the home objects and it should update only the bean, I faced this problem with Weblogic...

    If you are planning on updating the deployed bean at runtime probably it is not a good idea to store the home object references...

    Thanks,

    Kiran.
  3. Reference to the Home Object[ Go to top ]

    When you say "Updating", are you refering to updating the entity beans that are already been deployed?? So, dynamic updating of entity bean is not working with the home reference. Is that what you are referring to? Hrm. This is somewhat odd. If this is the case, it's probably a bug in WLS.. I think that WL should fix this bug... Getting the home reference at one time at setSessionContext and re-use them in every remote methods makes a perfect sense to me... Did you have any othr problem? I am using the WLS 5.1 with service pack 6. What about you?
  4. Reference to the Home Object[ Go to top ]

    <q> When you say "Updating", are you refering to updating the entity beans that are already been deployed?? </q>
    <ans> Exactly but I was referring to session beans...</ans>

    <q> So, dynamic updating of entity bean is not working with the home reference. Is that what you are referring to?
    </q>
    <ans> yup except that it is a session bean.... </ans>

    <q> Did you have any othr problem? </q>
    <ans> nope </ans>

    <q> I am using the WLS 5.1 with service pack 6. What about you?</q>
    <ans> WLS 5.1 but I vaguely remember that I cross checked to see if it works with the sp 6..but i dont think it worked </ans>

    Did you try this with session beans?

    Thanks,

    Kiran
  5. Reference to the Home Object[ Go to top ]

    <Q>Did you try this with session beans? </Q>

    Sorta.. My session bean refers to many entity beans which I am storing within the stateless session bean's private field. I am using it within session bean, but it's referencing the entity bean...

    Se Hee
  6. Reference to the Home Object[ Go to top ]

    This may be better solved by using a singleton to access all your entity and session bean homes. The singleton can then cache each home interface if it has not already been created. i.e. The methods on the singleton would look like the following.

    public CustomerHome getCustomerHome()
    {
        if(_cache.get("CustomerHome") == null)

    }





  7. Reference to the Home Object[ Go to top ]

    This may be better solved by using a singleton to access all your entity and session bean homes. The singleton can then cache each home interface if it has not already been created. i.e. The methods on the singleton would look like the following.

    public CustomerHome getCustomerHome()
    {
        if(_cache.get("CustomerHome") == null)
        {

    }





  8. Reference to the Home Object[ Go to top ]

    Hi,
    u better use the homehandle instead of home reference.
    why because homehandles are "MORE PERSISTANT" and according to EJB1.1 specification u r not gaurenteed with the persistance of the home reference.

    -subbu

  9. I agree with the last message - HomeHandle is exactly what you need. There is even a better solution combining singleton and HomeHandle. Try to create a utility class that will cache the HomeHandle for appropriate beans for you. Than define a method getXXXHome(). This method will try to get a Home object from cached HomeHandle. If everything's OK it will return your Home, else it will just fetch it from initial context again, extract its handle etc.
  10. Reference to the Home Object[ Go to top ]

    In the case of caching the reference/handle, is it referencing the same ejb? So, in the clustered environment, its handles will always return a same home in one particular system, is it not????? This way, it's not doing a dynamic lookup since it only returns the home reference in which it's been cached. If, the cached server goes down for whatever reason, how does it know to reference the available server??? Or am I getting it or wrong?

    Se Hee