Re: missing toOne

From: Tore Halset (halse..vv.ntnu.no)
Date: Thu May 27 2004 - 12:17:25 EDT

  • Next message: Andrus Adamchik: "Re: missing toOne"

    On May 27, 2004, at 16:14, Andrus Adamchik wrote:

    > I remember this used to be a bug in the past, but this should've been
    > fixed long time ago. "a.getB() == null" should work. So the question
    > is - what version of Cayenne are you using? And also how is the
    > relationship mapped?

    I am using 1.1M6. The relation is from ProductReplace to CdExport and
    is named "export". I think the following should be enough from the
    map.xml file.

             <obj-entity name="CdExport" className="CdExport"
    dbEntityName="CD_EXPORT">
                     <obj-attribute name="baseCd" type="java.lang.Boolean"
    db-attribute-path="BASE_CD"/>
                     <obj-attribute name="exportDate" type="java.util.Date"
    db-attribute-path="EXPORT_DATE"/>
                     <obj-attribute name="week" type="java.lang.Integer"
    db-attribute-path="EXPORT_WEEK"/>
                     <obj-attribute name="year" type="java.lang.Integer"
    db-attribute-path="EXPORT_YEAR"/>
             </obj-entity>
             <obj-relationship name="productReplaces" source="CdExport"
    target="ProductReplace">
                     <db-relationship-ref source="CD_EXPORT"
    target="PRODUCT_REPLACE" name="replaces"/>
             </obj-relationship>

             <obj-entity name="ProductReplace" className="ProductReplace"
    dbEntityName="PRODUCT_REPLACE">
                     <obj-attribute name="week" type="java.lang.Integer"
    db-attribute-path="REPLACEMENT_WEEK"/>
                     <obj-attribute name="year" type="java.lang.Integer"
    db-attribute-path="REPLACEMENT_YEAR"/>
             </obj-entity>
             <obj-relationship name="export" source="ProductReplace"
    target="CdExport">
                     <db-relationship-ref source="PRODUCT_REPLACE"
    target="CD_EXPORT" name="export"/>
             </obj-relationship>

             <db-entity name="CD_EXPORT" catalog="navision_jb">
                     <db-attribute name="BASE_CD" type="INTEGER"
    isMandatory="true" length="10"/>
                     <db-attribute name="EXPORT_DATE" type="TIMESTAMP"
    isMandatory="true" length="23"/>
                     <db-attribute name="EXPORT_WEEK" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="10"/>
                     <db-attribute name="EXPORT_YEAR" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="10"/>
             </db-entity>
             <db-relationship name="replaces" source="CD_EXPORT"
    target="PRODUCT_REPLACE" toDependentPK="false" toMany="true">
                     <db-attribute-pair source="EXPORT_WEEK"
    target="REPLACEMENT_WEEK"/>
                     <db-attribute-pair source="EXPORT_YEAR"
    target="REPLACEMENT_YEAR"/>
             </db-relationship>

             <db-entity name="PRODUCT_REPLACE" catalog="navision_jb">
                     <db-attribute name="PRODUCT_ID" type="VARCHAR"
    isPrimaryKey="true" isMandatory="true" length="8"/>
                     <db-attribute name="REPLACEMENT_ID" type="VARCHAR"
    isPrimaryKey="true" isMandatory="true" length="8"/>
                     <db-attribute name="REPLACEMENT_WEEK" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="10"/>
                     <db-attribute name="REPLACEMENT_YEAR" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="10"/>
             </db-entity>
             <db-relationship name="export" source="PRODUCT_REPLACE"
    target="CD_EXPORT" toDependentPK="false" toMany="false">
                     <db-attribute-pair source="REPLACEMENT_WEEK"
    target="EXPORT_WEEK"/>
                     <db-attribute-pair source="REPLACEMENT_YEAR"
    target="EXPORT_YEAR"/>
             </db-relationship>

    Regards,
      - Tore.



    This archive was generated by hypermail 2.0.0 : Thu May 27 2004 - 12:17:33 EDT