EJB Architecture Question


EJB design: EJB Architecture Question

  1. EJB Architecture Question (3 messages)

    I have the set of Entity EJBs, binded with some table in DataBase.

    Two clients use them.
    First client only reads data from Entity EJBs

    Second client reads and changes Entity EJB's properties.

    First client has critical business-logic, its high perfomance is very important, so we only one time copy Entity EJB Objects to local Objects and then use them.

    When Second client changes some properties in EJB,
    we have to notify the First client about it via JMS.
    When First client receives message, he reloads its local objects (copy of EJB).

    if we send JMS message in set[Property] of Entity EJB,
    First client receives this message, but when he attempts to reload its local object, he gets an OLD properties of EJB, because
    set[Property] methods run in transaction context of EJB container, so first client gets the message BEFORE transaction is commited.

    So we need to create another Session Bean, which calls set[Property] methods of Entity EJBs and send messages to first client.

    But problem is: we have a lot of Entity Beans, and each Entity bean has a lot of properties,
    so we have to pass in Session Bean [beanName], [propertyName] and [newPropertyValue] and write construction like

    if( beanName.equals( [EntityBean1] ) )
        // get from JNDI EntityBean1
    else if( beanName.equals( [EntityBean2] ) )
        // get from JNDI EntityBean2

    if( propertyName.equals( [EntityBean1_Property1] ) )
        entityBean1.setProperty1( [newPropertyValue] );
    else if( propertyName.equals( [EntityBean1_Property2] ) )
        entityBean1.setProperty2( [newPropertyValue] );


    but it is very sophisticated construction.

    My question is: are there any more laconic and simple solution than described above?

    Thank you,

    Moscow, Russia

    Threaded Messages (3)

  2. EJB Architecture Question[ Go to top ]

    Anton Please help me out...my problem is mentioned below

        I have just started doing ejbs.. i wrote first example using statelessSessionBean .. aim is to print "hello world"..for this i have written remote interface,home interface, session bean and client .. but the problem is that i dont know how to write "ejb-jar.xml" file and also "weblogic-ejb-jar.xml" file so please help me out with step by step guide to deploying ejb in weblogic server 5.1 and how to create "ejb-jar.xml file" and "weblogic-ejb-jar.xml" file manaually along with the entire solution for deploying.

    E-mail:sood_vibhor at yahoo dot com

  3. EJB Architecture Question[ Go to top ]

    You should install Borland JBuilder 5 and Borland App Server 4.5.1.
    When you start JBuilder, go to Help / Help Topics / Developing Enterprise Applications
    There you can find detailed instructions.

    JBuilder also has a lot of wizards (File / New / Enterprise ...), when you pass through them, they generate all code you need themselves.

    So you can study all generated files and understand how they work.

  4. EJB Architecture Question[ Go to top ]

    I think it's a good question if I have not misunderstood.
    I think just to employ Observer pattern will solve the problem.AFTER the change has done,THEN notify all the listeners.So that during the transaction,the read only client will read old data(and also not reveive the notification),after the notification the data must be refreshed.If you employ JMS,they should be synchronized.