Hi all,

 

I would like to know how to specify a nested field using ojb xdoclet.

I have not found in the doc how to do it.

 

To illustrate my question, I propose the class Address of which the
instances can be nested in different classes, but I have got many
classes that I would like to make embeddable. An Address in this case is
nested in a ContactPerson.

 

 

/**

 * @ojb.class table="CONTACT_PERSON"

 *            documentation="The nesting class."

 */

public class ContactPerson implements java.io.Serializable {

  /**

   * @ojb.field ????

   *            

   */  

    protected Address address; /* nested object of a contact person */

    protected String name;

    protected String firstname;

    ...

}

 

/**

 * @ojb.class ???? 

 *            documentation="The nested class."

 */

public class Address implements java.io.Serializable {    

    protected String streetName

    protected String streetNumber

    protected String zip;

    ...

}

 

I would like to generate a repository.xml file that includes a mapping
specifying attributes of the nested object. Of course I do not want to
manually edit the generated mapping.

 

   <class-descriptor

      class="be.gfdi.business.base.ContactPerson"

      table="CONTACT_PERSON"

   >

      <field-descriptor

         name="name"

         column="NAME"

         jdbc-type="VARCHAR"

      />

 

      ...

 

      <field-descriptor

         name="address::streetName"

         column="STREET_NAME"

         jdbc-type="VARCHAR"

      />

 

      <field-descriptor

         name="address::streetNumber"

         column="STREET_NUMBER"

         jdbc-type="VARCHAR"

      />

 

      <field-descriptor

         name="address::zip"

         column="ZIP_CODE"

         jdbc-type="VARCHAR"

      />

 

 

Many thanks for your help,

 

Pierre

 

 

 

Reply via email to