hello.

please help! 



2003-10-28 11:10:45,307 ERROR [STDERR]
org.apache.ojb.broker.OJBRuntimeException: Incorrect field reference
"salesPersonId" in
[EMAIL PROTECTED]
delete=false,cascade retrieve=true,cascade store=true,is lazy=false,class of
Items=interface domain.Price]
        at
org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFieldD
escriptors(Unknown Source)


I defined the following interfaces and classes:


public interface Price implements Serializable {
        public String getId();
        public Article getArticle();
        public SalesPerson getSalesPerson();
        public double getValue();
}

public class CustomerPriceImpl implements Price {
        private String id;
        private String articleId;
        private String salesPersonId;
        private double value;
        private SalesPerson salesPerson;        // 1:1 reference to Customer
        ....
        public Customer getSalesPerson() {
                return (Customer) salesPerson;
        }
        ....
}

public interface Article implements Serializable {
        public String getId();
        public String getArticleNo();
        public Collection getPrices();
}

public interface SalesPerson implements Serializable {
        public String getId();
        public String getName();
        public Collection getPrices();
}

public class CustomerImpl implements SalesPerson {
        private String id;
        private String name;
        private Collection prices = new ArrayList(); // 1:n prices
        ....
}



the mapping look like:

<!-- mapping interface Price -->
<class-descriptor class="domain.Price">
        <extent-class class-ref="domain.CustomerPriceImpl"/>
</class-descriptor>

<class-descriptor class="CustomerPriceImpl">
        <field-descriptor
                name="id"
                column="id"
                jdbc-type="VARCHAR"
                autoincrement="true"
                primarykey="true"/>
        ...
        <reference-descriptor
                name="salesPerson"
                class-ref="domain.CustomerImpl">
                <foreignkey field-ref="salesPersonId"/>
        </reference-descriptor>
</class-descriptor>

<!-- mapping interface SalesPerson -->
<class-descriptor class="domain.SalesPerson">
        <extent-class class-ref="domain.CustomerImpl"/>
        <extent-class class-ref="domain.TraderImpl"/>
</class-descriptor>

<class-descriptor class="domain.CustomerImpl">
        <field-descriptor
                name="id"
                column="id"
                jdbc-type="VARCHAR"
                autoincrement="true"
                primarykey="true"/>
        ....
        <collection-descriptor
        name="prices"
        element-class-ref="domain.Price"
        proxy="true"
        auto-retrieve="true"
            auto-update="true">
        <inverse-foreignkey field-ref="salesPersonId"/>
     </collection-descriptor>           
</class-descriptor>

<!-- mapping interface Article -->
<class-descriptor class="domain.Article">
        <extent-class class-ref="domain.CompetitiveArticleImpl"/>
</class-descriptor>







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to