History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: EJB-91
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Vance Karimi
Reporter: heapifyman
Votes: (View)
Watchers: (View)
Operations

If you were logged in you would be able to see more operations.
EJB Cartridge

Injection of Local Service Bean fails

Created: 24/Sep/07 10:01 AM   Updated: 25/Sep/07 11:21 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Environment: WinXP Pro, Java 1.5.12, Maven 2.0.5, AndroMDA 3.3-SNAPSHOT, EJB3-cartridge 1.0-SNAPSHOT, MagicDraw 12.1 Personal Edition


 Description   
Create a Service Bean "LocalServiceBean" with "andromda.ejb.viewType = local" and another remote Service Bean "RemoteServiceBean" in your UML model.
Then create a dependency from RemoteServiceBean to LocalServiceBean.

The generated code for injecting the LocalServiceBean is faulty because it ignores the viewType and tries do inject a remote interface which does not exist (see below):

@javax.ejb.EJB
protected foo.bar.LocalServiceBeanRemote localServiceBean;

 All   Comments   Change History      Sort Order:
Comment by heapifyman [25/Sep/07 11:21 AM]
As suggested in http://galaxy.andromda.org/forum/viewtopic.php?t=5159 I tried the following changes and they worked for me:
- changed EJB Injection Definitions in "SessionBeanBase.vsl" from
    @javax.ejb.EJB
    protected ${reference.fullyQualifiedServiceRemoteInterfaceName} $stringUtils.uncapitalize(${reference.name});
  to:
    @javax.ejb.EJB
    protected ${reference.fullyQualifiedInjectedServiceInterfaceName} $stringUtils.uncapitalize(${reference.name});

- added the attribute "fullyQualifiedInjectedServiceInterfaceName" (copied from fullyQualifiedServiceRemoteInterfaceName) in the "EJB3SessionFacade" in the UML model.

- added the following code in "EJB3SessionFacadeLogicImpl":
     /**
     * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleGetFullyQualifiedInjectedServiceInterfaceName()
     */
    protected String handleGetFullyQualifiedInjectedServiceInterfaceName()
    {
     if (this.isViewTypeLocal() || this.isViewTypeBoth()) {
     return this.getFullyQualifiedServiceLocalInterfaceName();
     } else {
     return this.getFullyQualifiedServiceRemoteInterfaceName();
     }
    }