Hello,

I tried to create a simple Entity Bean called "HelloWorldData" which uses a String (called "id") as Primary Key and an additional String (called "text") as property. When i started the ant task to start AndroMDA I got an error during the compilation of the created code. AndroMDA generated the abstract "HelloWorldDataBean" class and created the abstract accessor methods for the properties. The problem arises in the ejbCreateImpl() method, because the generated code tries to access the property "id" directly and not by using the accessors

protected void ejbCreateImpl() throws javax.ejb.CreateException{
  if (id == null) {
    id = new java.rmi.server.UID().toString();
  }
}

I think this is a small mistake in the template or did I overlook something?

Best regards,
Stefan











-------- complete code of generated class ----------------------
/* Autogenerated by AndroMDA (EntityBean.vsl) - do not edit */
package de.novatec.crm;

/**
* Autogenerated EJB implementation class for HelloWorldData
*
*
*
* @ejb.bean generate="true"
* name="HelloWorldData"
* type="CMP"
* cmp-version="2.x"
* view-type="local"
* local-jndi-name = "ejb/de.novatec.crm.HelloWorldData/Local"
* primkey-field = "id"
*
* @ejb.interface generate="false" local-class="de.novatec.crm.HelloWorldData"
* @ejb.home generate="false" local-class="de.novatec.crm.HelloWorldDataLocalHome"
* @ejb.pk generate = "false" class = "java.lang.String"
*
* @ejb.persistence table-name="HELLO_WORLD_DATA"
*
*
* @ejb.finder signature="java.util.Collection findByName(java.lang.String name)"
* query="SELECT DISTINCT OBJECT(c) FROM HelloWorldData as c WHERE c.name = ?1"
*
* @ejb.finder signature="java.util.Collection findAll()"
* query="SELECT DISTINCT OBJECT(c) FROM HelloWorldData as c"
*/
public abstract class HelloWorldDataBean
implements javax.ejb.EntityBean
{
// ----------- constant definitions -----------


   // -- accessors for environment entries --

   // -- accessors for constants --

   // --------------- attributes ---------------------
   /**
    * Get the id property
    *
    *
    * @ejb.pk-field
    * @ejb.persistence
    *     column-name="ID"
    *       jdbc-type="java.lang.String"
    *        sql-type="java.lang.String"
    *
    */
   public abstract java.lang.String getId();

   /**
    * Set the id property
    * @param value the new value
    */
   public abstract void setId(java.lang.String value);

   /**
    * Get the text property
    *
    *
    * @ejb.persistence
    *     column-name="TEXT"
    *       jdbc-type="java.lang.String"
    *        sql-type="java.lang.String"
    *
    */
   public abstract java.lang.String getText();

   /**
    * Set the text property
    * @param value the new value
    */
   public abstract void setText(java.lang.String value);


// ------------- CMR relations ------------------

   // ---------------- business and select methods  ----------------------

  /**
   *
   *
   * @ejb.interface-method
   */
   public abstract java.util.Collection findByName(java.lang.String name);

  /**
   *
   *
   * @ejb.interface-method
   */
   public abstract java.util.Collection findAll();


// ---------------- create methods --------------------


/** * Implementation for the create method with all CMP attributes. * This method calls the super class implementation for inherited * CMP fields and sets all CMP fields defined in this class to the * values provided by the parameters. Override this method in the * implementation class if you need different behaviour. * * This extra implementation method is necessary to avoid * problems with different primary key classes. * */ protected void ejbCreateImpl() throws javax.ejb.CreateException { if (id == null) { id = new java.rmi.server.UID().toString(); }

   }

/**
* Create method with all CMP attribute values.
* @ejb.create-method
* @ejb.transaction type="Required"
* @return <code>null</code> as required by the EJB specification for CMP
* (chapter 10.5.2, "Bean Provider's entity bean instance's view")
*/
public java.lang.String ejbCreate()
throws javax.ejb.CreateException
{
ejbCreateImpl();
return null;
}


   public void ejbPostCreate()
          throws javax.ejb.CreateException
   {
   }
   // ---------------- accessor methods for bean references ---------------


}


------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Andromda-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to