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

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

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

Controller implementation tries to call service class (not service bean). I am using the ejb3 and jsf cartridges.

Created: 19/Sep/06 03:29 AM   Updated: 20/Sep/06 03:53 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Environment: Mac os X


 Description   
Here is the controller generated code, from web/target --- there is no ProjectService class genertated

   /**
     * Returns a reference to the projectService back-end service.
     */
    protected final pts.service.ProjectService getProjectService()
    {
        try
        {
            return pts.ServiceLocator.instance().getProjectService();
        }
        catch (final Throwable throwable)
        {
            throw new RuntimeException(throwable);
        }
    }

 All   Comments   Change History      Sort Order:
Comment by Pat Casey [19/Sep/06 10:49 PM]
Should this issue be in the JSF queue? I looked at the VSL and it appears that the Controller class is generated from there.

What is the connection to tell JSF to generate a delegate pattern instead of a service locater pattern?

Comment by Chad Brandon [19/Sep/06 10:52 PM]
You need to change the serviceAccessorPattern namespace property (in the jsf namespace) appropriately for your framework:

i.e. <property name="serviceAccessorPattern">${application.package}.ServiceLocator.instance().get{1}()</property>

Comment by Pat Casey [20/Sep/06 12:22 AM]
Chad

Thanks for the quick response.

My adromda.xml file actually has the property set as you indicate. I looked into the how tos and found a different setting for ejb and set that. Same result, however I think I can get the accessor to work by tweaking the property.

In addition to that issue, the generated controller code has a method that returns a ProectService reference instead of a reference to the bean (see method header).

    /**
     * Returns a reference to the projectService back-end service.
     */
    protected final pts.service.ProjectService getProjectService()
    {
        try
        {
            return pts.ProjectServiceUtil.getHome().create();
        }
        catch (final Throwable throwable)
        {
            throw new RuntimeException(throwable);
        }
    }

Is there another property that controls this generaton?

Comment by Vance Karimi [20/Sep/06 03:53 AM]
A workaround I can suggest is to remove the modelled dependencies from your controller to the session beans. The getters won't be generated and will leave you to implement the delegate calls in the controller implementation class.

Ultimately, I think the ejb3 cartridge should be used with a seam cartridge that extends the jsf cartridge, thereby (I think) eliminating service locators and delegates all together.