Hi Manisha,

<manisha>

1. How do you map a entity container managed
bean-field, which is not of java primitive type, but
an instance of a composite class to database. The
bean-field may require mapping to a table than a
column. How can you do it ? Can I assume this is the
limitation of CMP ?"

<manisha>

<vendor>

1. Mapping of a 'composite class' to multiple columns in a table is
supported by the Inprise Application Server builtin cmp engine. The
following extract shows how an address javabean is mapped to a seperate
table across multiple columns:

          <column-map>
            <field-name>address.city</field-name>
            <column-name>inst_address.city</column-name>
            <column-type>VARCHAR(40)</column-type>
          </column-map>
          <column-map>
            <field-name>address.state</field-name>
            <column-name>inst_address.state</column-name>
            <column-type>CHAR(2)</column-type>
          </column-map>
          <column-map>
            <field-name>address.street1</field-name>
            <column-name>inst_address.street1</column-name>
            <column-type>VARCHAR(40)</column-type>
          </column-map>
          <column-map>
            <field-name>address.street2</field-name>
            <column-name>inst_address.street2</column-name>
            <column-type>VARCHAR(40)</column-type>
          </column-map>
          <column-map>
            <field-name>address.zip</field-name>
            <column-name>inst_address.zip</column-name>
          </column-map>
          <column-map>

where inst_address is the table name. We extend this support to finders:

        <finder>
        <method-signature>findByAddress(Address address)</method-signature>
        <where-clause>SELECT id FROM inst_address WHERE
        (:address.street1 IS NULL OR :address.street1 = street1) AND
        (:address.street2 IS NULL OR :address.street2 = street2) AND
        (:address.city  IS NULL OR :address.city    = city)    AND
        (:address.state   IS NULL OR :address.state   = state)   AND
        (:address.zip  =  0  OR :address.zip     = zip)
                </where-clause>
        <load-state>False</load-state>
        </finder>

Is this a limitation of CMP? NO. Is it a limitation of your containers cmp
engine? YES.

</vendor>

William Louth
Inprise
www.inprise.com/appserver

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to