Different entity bean using same bean classes - Weblogic

This is a discussion on Different entity bean using same bean classes - Weblogic ; Hi, We are using weblogic 8.1 SP2 on Windows 2000. In the system we are developing there are many tables that capture "master data". Such tables have identical columns (PK, name, description ) and access mechanism to this data is ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Different entity bean using same bean classes

  1. Different entity bean using same bean classes


    Hi,
    We are using weblogic 8.1 SP2 on Windows 2000.

    In the system we are developing there are many tables that capture "master data".
    Such tables have identical columns (PK, name, description ) and access mechanism
    to this data is also same.

    We started off with read only entity beans - a seperate entity bean for each such
    table.

    Now we feel that the instead of seperate local, home and bean class (which are
    all identical) we should have one such set and then be able to reuse them for
    all bean definitions.

    We tried it by making the appropriate entries in the deployment descriptor. For
    example 2 different bean entries in ejb-jar.xml are given the same home/local/bean
    class but different . In weblogic-cmp-rdbms the for these
    two beans are different.

    We now find that the server can not differentiate between these beans and always
    the values for the bean that gets loaded first are remembered.

    So when do a "findAll" for "transaction types" we get correct data. Then when
    we do a "findAll" for "balance types" we again get "transaction types"

    Can anyone please give us a solution to this problem ?

    Thanks
    Kingshuk



  2. Re: Different entity bean using same bean classes

    "Kingshuk" wrote in message news:40b755e8$1@mktnews1...
    > We now find that the server can not differentiate between these beans and always
    > the values for the bean that gets loaded first are remembered.
    >
    > So when do a "findAll" for "transaction types" we get correct data. Then when
    > we do a "findAll" for "balance types" we again get "transaction types"
    >
    > Can anyone please give us a solution to this problem ?


    Do you have different JNDI names associated with
    beans using the same implementation?

    Regards,

    Slava Imeshev



  3. Re: Different entity bean using same bean classes


    Yes the jndi names were different.

    We found a way to sidestep this problem -

    The home interfaces need to be different for each bean (with local and bean class
    being same). Then the behaviour is as expected - we are getting appropriate data
    for the finders.

    The home interfaces for all such beans now extend a common interface that declares
    all the methods we need. The individual home interfaces do not have any method
    declaration.


    Thanks
    Kingshuk
    "Slava Imeshev" wrote:
    >"Kingshuk" wrote in message news:40b755e8$1@mktnews1...
    >> We now find that the server can not differentiate between these beans

    >and always
    >> the values for the bean that gets loaded first are remembered.
    >>
    >> So when do a "findAll" for "transaction types" we get correct data.

    >Then when
    >> we do a "findAll" for "balance types" we again get "transaction types"
    >>
    >> Can anyone please give us a solution to this problem ?

    >
    >Do you have different JNDI names associated with
    >beans using the same implementation?
    >
    >Regards,
    >
    >Slava Imeshev
    >
    >



  4. Re: Different entity bean using same bean classes

    "Kingshuk" wrote in message news:40bed49d$1@mktnews1...
    > Yes the jndi names were different.
    >
    > We found a way to sidestep this problem -
    >
    > The home interfaces need to be different for each bean (with local and bean class
    > being same). Then the behaviour is as expected - we are getting appropriate data
    > for the finders.
    >
    > The home interfaces for all such beans now extend a common interface that declares
    > all the methods we need. The individual home interfaces do not have any method
    > declaration.


    Interesting. I'd check with support regarding this.

    -- Slava



  5. Re: Different entity bean using same bean classes


    Hi Slava,
    This is what I understood/guessed of the problem -

    The finder methods are declared in the home interface.

    The container generated implementation of the home interface has the required
    SQL code for the finder methods that we need.

    When I invoke a finder method (on home), the appropriate home interface implementation
    is loaded and the SQL query executed. I get the expected result.

    Next time for a different bean when I look up the home, it takes me to the same
    home object implementation. The finder methods in this object uses the table
    for the previous bean not the current bean. --- Note that this is just my guess.
    I haven't spoken to anyone in support.

    So if the above is right, then -

    the finder method implementations are pinned to a home class rather than a bean
    (as defined in the ejb-jar.xml).

    consequently many entity ejbs can not share the same home.

    Regards
    Kingshuk



    "Slava Imeshev" wrote:
    >"Kingshuk" wrote in message news:40bed49d$1@mktnews1...
    >> Yes the jndi names were different.
    >>
    >> We found a way to sidestep this problem -
    >>
    >> The home interfaces need to be different for each bean (with local

    >and bean class
    >> being same). Then the behaviour is as expected - we are getting appropriate

    >data
    >> for the finders.
    >>
    >> The home interfaces for all such beans now extend a common interface

    >that declares
    >> all the methods we need. The individual home interfaces do not have

    >any method
    >> declaration.

    >
    >Interesting. I'd check with support regarding this.
    >
    >-- Slava
    >
    >



+ Reply to Thread