facebook

XDoclet generates partial home interface [Closed]

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #206837 Reply

    fmfaulkner
    Member

    I’ve specified, for some beans, that only the local interface should be generated, but am getting errors on the remote home interface because it is partially generated. How do you prevent remote home interfaces from being generated on certain beans?

    #206851

    Greg
    Member

    Could you describe your situation a little more? Are you having trouble with session or entity beans? Are you getting errors in MyEclipse or when deploying to a appserver? I tried creating local interfaces and I don’t get any errors or partially generated remote interfaces. But I am probably not correctly recreating your situation. Which files do you believe are getting generated incorrectly? Let us know and we can try to help.

    #207081

    europarl
    Member

    Dear support team,

    I have a similar problem, which is surely coming from a misuse of XDoclet, but let me expose it anyway!

    I have created with the wizard an entity bean named FooBean starting like this:

     * @ejb.bean name = "Foo"
     *           type = "CMP"
     *           cmp-version = "2.x"
     *           display-name = "FooBean"
     *           description = "FooBean CMP"
     *           view-type = "local"
     *           local-jndi-name = "local/ec.ep.dit.isp.test.ejb.FooBean"
     *                      primkey-field = "pk"
     *
     * @ejb.persistence table-name = "foo" 
     * 
     * @jboss.persistence create-table = "false"
     *                                         remove-table = "false"
     *                                         datasource = "java:jdbc/mysql"
     *                                         datasource-mapping = "mySQL"
     */
    public abstract class FooBean implements EntityBean {
    
        /** The EntityContext */
        private EntityContext context;
    
        /**
         * @ejb.persistence column-name = "pk" jdbc-type = "INTEGER"
         */
        abstract public Integer getPk();
        /**
         * @ejb.persistence column-name = "pk" jdbc-type = "INTEGER"
         */
        abstract public void setPk(Integer newVal);
        /**
         * @ejb.persistence column-name = "msg" jdbc-type = "VARCHAR"
         */
        abstract public String getMsg();
        /**
         * @ejb.persistence column-name = "msg" jdbc-type = "VARCHAR"
         */
        abstract public void setMsg(String newVal);
    

    After running XDoclet I get FooCMP (which extends FooBean) correctly created. I also get the FooLocalHome and FooLocal interfaces.

    Unfortunately, FooLocal (extends javax.ejb.EJBLocalObject) is empty – I expect to find there at least the fields of my entity bean.

    FYI: I can generate perfect local or remote interfaces of session beans.

    Thanks for any feedback,
    Kind regards,
    David

    #207088

    Greg
    Member

    David,

    For get/set fields in your CMP bean to show up in FooLocal you have to set @ejb.interface-method view-type=”local” for each method you want to appear in the EJBLocalObject. Also, just a FYI, you only have to declare @ejb.persistence … once per get/set pair. Declaring them twice causes no problems though.

    
    /**
     * 
     * @ejb.bean name = "Foo" 
     *           type = "CMP" 
     *           cmp-version = "2.x" 
     *           display-name = "FooBean" 
     *           description = "FooBean CMP" 
     *           view-type = "local" 
     *           local-jndi-name = "local/ec.ep.dit.isp.test.ejb.FooBean" 
     *           primkey-field = "pk" 
     * 
     * @ejb.persistence table-name = "foo" 
     * 
     * @jboss.persistence create-table = "false" 
     *                               remove-table = "false" 
     *                               datasource = "java:jdbc/mysql" 
     *                               datasource-mapping = "mySQL" 
     *
     */
    public abstract class FooBean implements EntityBean {
    
        /** The EntityContext */
        private EntityContext context;
    
        /** 
        * @ejb.persistence 
        *         column-name = "pk" 
        *         jdbc-type = "INTEGER" 
        * 
        * @ejb.interface-method 
        *         view-type = "local"
        */ 
           abstract public Integer getPk(); 
        
        /**
         * @ejb.interface-method 
         *         view-type = "local"
         */
           abstract public void setPk(Integer newVal); 
           
           /** 
         * @ejb.persistence 
         *         column-name = "msg" 
         *         jdbc-type = "VARCHAR" 
         * 
         * @ejb.interface-method 
         *         view-type = "local"
         */ 
           abstract public String getMsg(); 
           
           /**
           * @ejb.interface-method 
           *         view-type = "local"
           */
           abstract public void setMsg(String newVal);
    

    It seems logical that the @ejb.bean …. view-type=local would propogate to the underlying CMP fields. But that attribute is only used to say that local interfaces are available in this bean, it doesn’t automatically make all get/set methods local. So you have to specify them individually.

    #207119

    europarl
    Member

    This works like a charm.

    Once again: kudos for MyEclipse support team!

    David

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: XDoclet generates partial home interface [Closed]

You must be logged in to post in the forum log in