Re: NullPointerException in QueryUtils$ExpressionTranslator.reverseDbPath(ObjEntity, String)

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Oct 02 2003 - 13:42:15 EDT

  • Next message: Andrus Adamchik: "Re: newbie - Cayenne, Ant, JBoss?"

    Mike Kienenberger <mkienen..laska.net> wrote:
    > My problem, maybe irrelevent, is probably that PendingPayment should be
    set
    > toDependentPK=true since PendingPayment has the same primary key as
    > PaymentHistory and is really nothing more than a database pointer into the

    > PaymentHistory table, but currently is set to toDependentPK=false.

    Ok. This was mis-information. I have another
    almost-identical-in-format-and-purpose table that this is true for, but
    PENDING_PAYMENT has a primary meaningless key and a foreign key to
    PAYMENT_HISTORY.

    So I don't know why it caused a problem. I do see asymmetry in the
    relationships (no reverse for PendingPayment's paymentHistory relationship)
    in the model.xml file.

    This was an imported EOModel -- is it malformed somehow? Do all
    relationships need to have a reverse relationship defined?

    -Mike

    --------------PENDING PAYMENT description----------------
            <db-entity name="PENDING_PAYMENT">
                    <db-attribute name="PAYMENT_ID" type="INTEGER" isMandatory="true"
    length="8"/>
                    <db-attribute name="PENDING_PAYMENT_ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true" length="8"/>
                    <db-key-generator>
                            <db-generator-type>ORACLE</db-generator-type>
                            <db-generator-name>PENDING_PAYMENT_SEQ</db-generator-name>
                            <db-key-cache-size>1</db-key-cache-size>
                    </db-key-generator>
            </db-entity>

            <obj-entity name="PendingPayment"
    className="com.gvea.cayenne.ebpp.entity.PendingPayment"
    dbEntityName="PENDING_PAYMENT">
            </obj-entity>

            <obj-relationship name="paymentHistory" source="PendingPayment"
    target="PaymentHistory" toMany="false">
                    <db-relationship-ref source="PENDING_PAYMENT" target="PAYMENT_HISTORY"
    name="paymentHistory"/>
            </obj-relationship>

            <db-relationship name="paymentHistory" source="PENDING_PAYMENT"
    target="PAYMENT_HISTORY" toDependentPK="false" toMany="false">
                    <db-attribute-pair source="PAYMENT_ID" target="PAYMENT_ID"/>
            </db-relationship>
    --------------end PENDING PAYMENT description----------------

    --------------PAYMENT HISTORY description----------------
            <db-entity name="PAYMENT_HISTORY">
                    <db-attribute name="ACCOUNT_NUMBER" type="INTEGER" isMandatory="true"
    length="8"/>
                    <db-attribute name="PAYMENT_ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true" length="8"/>
    [...IRRELEVENT database field attributes...]
                    <db-key-generator>
                            <db-generator-type>ORACLE</db-generator-type>
                            <db-generator-name>PAYMENT_HISTORY_SEQ</db-generator-name>
                            <db-key-cache-size>1</db-key-cache-size>
                    </db-key-generator>
            </db-entity>

            <obj-entity name="PaymentHistory"
    className="com.gvea.cayenne.ebpp.entity.PaymentHistory"
    dbEntityName="PAYMENT_HISTORY">
    [...IRRELEVENT database object attributes...]
            </obj-entity>

            <obj-relationship name="account" source="PaymentHistory" target="Account"
    toMany="false">
                    <db-relationship-ref source="PAYMENT_HISTORY" target="ACCOUNT"
    name="account"/>
            </obj-relationship>

            <db-relationship name="account" source="PAYMENT_HISTORY" target="ACCOUNT"
    toDependentPK="false" toMany="false">
                    <db-attribute-pair source="ACCOUNT_NUMBER" target="ACCOUNT_NUMBER"/>
            </db-relationship>


            <obj-relationship name="paymentHistoryList" source="Account"
    target="PaymentHistory" toMany="true">
                    <db-relationship-ref source="ACCOUNT" target="PAYMENT_HISTORY"
    name="paymentHistoryList"/>
            </obj-relationship>

            <db-relationship name="paymentHistoryList" source="ACCOUNT"
    target="PAYMENT_HISTORY" toDependentPK="false" toMany="true">
                    <db-attribute-pair source="ACCOUNT_NUMBER" target="ACCOUNT_NUMBER"/>
            </db-relationship>

            <obj-relationship name="paymentHistory" source="PendingPayment"
    target="PaymentHistory" toMany="false">
                    <db-relationship-ref source="PENDING_PAYMENT" target="PAYMENT_HISTORY"
    name="paymentHistory"/>
            </obj-relationship>

    --------------end PAYMENT HISTORY description----------------



    This archive was generated by hypermail 2.0.0 : Thu Oct 02 2003 - 13:41:58 EDT