views:

129

answers:

1

Can one declare multiple beans in the ejb-jar.xml (in EJB 1.1) deployment descriptor with different names but the same classes behind?

For example:

<session>
    <ejb-name>AccountFacade</ejb-name>
    <home>com.something.ejb.AccountFacadeHome</home>
    <remote>com.something.ejb.AccountFacadeRemote</remote>
    <ejb-class>com.something.ejb.AccountFacadeBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Bean</transaction-type>
</session>

<session>
    <ejb-name>RestrictiveAccountFacade</ejb-name>
    <home>com.something.ejb.AccountFacadeHome</home>
    <remote>com.something.ejb.AccountFacadeRemote</remote>
    <ejb-class>com.something.ejb.AccountFacadeBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Bean</transaction-type>
</session>

For RestrictiveAccountFacade I want to set a higher isolation level in the orion-ejb-jar.xml file, something like:

<entity-deployment name="AccountFacade" location="AccountFacade">
    <resource-ref-mapping location="..." name="jdbc/..."/>
</entity-deployment>

<entity-deployment name="RestrictiveAccountFacade" location="RestrictiveAccountFacade" isolation="serializable">
    <resource-ref-mapping location="..." name="jdbc/..."/>
</entity-deployment>

Is there a risk involved in doing this, any side effects or unspecified behavior?

A: 

This is totally OK to have it as you mentioned above. One should note that as per container is concerned AccountFacade and RestrictiveAccountFacade will be two totally unrelated session beans.

However RestrictiveAccountFacade has transaction serializable access to same jdbc resource as AccountFacade so they will interfere with each other only at transaction isolation level.

Hence AccountFacade may be blocked if it needs access to same record as that is participated in transaction of RestrictiveAccountFacade.

Similarly RestrictiveAccountFacade transaction will be blocked on same record as that is being used by AccountFacade in it's transaction.

Gladwin Burboz