0 Replies Latest reply on Jan 6, 2003 5:13 PM by ryan sonnek

    CMP composite field problems.

    ryan sonnek Newbie

      after searching through the forums, and finding several related questions, but few answers, i've decided to post my question here. i'm working with a CMP composite field using jboss 3.0.4 and oracle 8i. i've gone through the paydoc's several times, and can't pinpoint where this is wrong. my audit object has 4 fields, 2 string and 2 date. all have correct getters/setters. the cmp bean has a getter and setter for the Audit object. the sql that is generated is trying to work with the audit object as if it's a blob, and not 4 seperate fields.

      any direction would be appreciated. i've included a dump from the server.log along with my relevent ejb-jar.xml and jbosscmp-jdbc.xml.
      Ryan


      server.log (cleaned up for readibility)
      --------------------------------------------------
      Executing SQL: INSERT INTO BCS_DEPARTMENT (department_num, name, description, audit) VALUES (?, ?, ?, ?)
      Set parameter: index=1, jdbcType=INTEGER, value=NULL
      Set parameter: index=2, jdbcType=VARCHAR, value=department 2
      Set parameter: index=3, jdbcType=VARCHAR, value=department description2
      Set parameter: index=4, jdbcType=BLOB,
      value=username:null;processCode:DepartmentBean.create;dateCreated:null;dateU
      pdated:null
      Could not create entity

      ejb-jar.xml (included only the relevent CMP object)
      ---------------------------------------------------------------------------

      [CDATA[Abstract class for Departments.]]
      <display-name>Department</display-name>

      <ejb-name>Department</ejb-name>

      <local-home>com.bpc.bcs.interfaces.DepartmentLocalHome</local-home>
      com.bpc.bcs.interfaces.DepartmentLocal

      <ejb-class>com.bpc.bcs.ejb.DepartmentCMP</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      false
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Department</abstract-schema-name>
      <cmp-field >
      [CDATA[gets this department id.]]
      <field-name>departmentID</field-name>
      </cmp-field>
      <cmp-field >
      [CDATA[gets the name of this
      department.]]
      <field-name>name</field-name>
      </cmp-field>
      <cmp-field >
      [CDATA[gets the description of this
      department.]]
      <field-name>description</field-name>
      </cmp-field>
      <cmp-field >
      [CDATA[Gets the database audit information for
      this bean.]]
      <field-name>audit</field-name>
      </cmp-field>
      <primkey-field>departmentID</primkey-field>

      <resource-ref >
      <res-ref-name>jdbc/bcs/bcsuser</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>


      <query-method>
      <method-name>findAll</method-name>
      <method-params>
      </method-params>
      </query-method>
      <ejb-ql>[CDATA[SELECT OBJECT(d) from Department d]]</ejb-ql>

      <!-- Write a file named ejb-finders-DepartmentBean.xml if you want
      to define extra finders. -->


      jbosscmp-jdbc.xml (only included relevent CMP object)
      ---------------------------------------------------------------

      <ejb-name>Department</ejb-name>
      <table-name>bcs_department</table-name>

      <cmp-field>
      <field-name>departmentID</field-name>
      <column-name>department_num</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>name</field-name>
      <column-name>name</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>description</field-name>
      <column-name>description</column-name>

      </cmp-field>
      <cmp-field>
      <field-name>audit</field-name>

      <property-name>audit.username</property-name>
      <column-name>audit_id</column-name>


      <property-name>audit.processCode</property-name>
      <column-name>audit_process_code</column-name>


      <property-name>audit.dateCreated</property-name>
      <column-name>audit_insert_dtm</column-name>


      <property-name>audit.dateUpdated</property-name>
      <column-name>audit_dtm</column-name>


      </cmp-field>

      <!-- merge point: jbosscmp-jdbc-load-{0}.xml -->