You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by David Norwood <da...@virtuant.com> on 2007/06/29 07:49:07 UTC

ERROR "No property for arcId toXyz..."

Hi,

 

I've seen a couple posts awhile ago about this error. Andrus had offered a
solution, but it's not working for me. I re-imported the classes involved
into Modeler and re-gened the classes. No fix. Any help??

 

Here's the problem: when attempting to insert new records into a 1-n
relationship, I'm getting this error:

 

org.apache.cayenne.CayenneRuntimeException: [v.2.0.3 May 6 2007] No property
for arcId toReportgroup

      at org.apache.cayenne.access.ObjectDiff.addDiff(ObjectDiff.java:228)

      at
org.apache.cayenne.access.ObjectStore.registerDiff(ObjectStore.java:207)

      at
org.apache.cayenne.access.ObjectStore.recordArcCreated(ObjectStore.java:132)

      at
org.apache.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:2
97)

      at
org.apache.cayenne.CayenneDataObject.setReverseRelationship(CayenneDataObjec
t.java:362)

      at
org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:
281)

      at
com.xyz.abc.db.auto._ReportGroup.addToReportdetailArray(_ReportGroup.java:55
)

 

but I can't see where the error is coming from. Here's the parent class
snippet:

 

public class _ReportGroup extends org.apache.cayenne.DataObject {

 

    public static final String INSTRUCTIONS_PROPERTY = "instructions";

    public static final String ISREQUIRED_PROPERTY = "isrequired";

    public static final String NAME_PROPERTY = "name";

    public static final String ROLEID_PROPERTY = "roleid";

    public static final String REPORTDETAIL_ARRAY_PROPERTY =
"reportdetailArray";

    public static final String REPORTNOTES_ARRAY_PROPERTY =
"reportnotesArray";

    public static final String TO_REPORT_PROPERTY = "toReport";

 

    public static final String ID_PK_COLUMN = "ID";

..

    public void addToReportdetailArray(com.xyz.abc.db.ReportDetail obj) {

        addToManyTarget("reportdetailArray", obj, true);

    }

    public void removeFromReportdetailArray(com.xyz.abc.db.ReportDetail obj)
{

        removeToManyTarget("reportdetailArray", obj, true);

    }

    public List getReportdetailArray() {

        return (List)readProperty("reportdetailArray");

    }

 

And the child class:

 

public class _ReportDetail extends org.apache.cayenne.DataObject {

 

    public static final String COLUMNCNT_PROPERTY = "columncnt";

..

    public static final String VALUE_PROPERTY = "value";

    public static final String TO_REPORT_PROPERTY = "toReport";

    public static final String TO_REPORTGROUP_PROPERTY = "toReportgroup";

 

    public static final String ID_PK_COLUMN = "ID";

..

    public void setToReportgroup(com.xyz.abc.db.ReportGroup toReportgroup) {

        setToOneTarget("toReportgroup", toReportgroup, true);

    }

 

    public com.xyz.abc.db.ReportGroup getToReportgroup() {

        return (com.xyz.abc.db.ReportGroup)readProperty("toReportgroup");

    }

 

And the process logic:

 

      while (dit.hasNext()) {

 

            PlanDetail aPlanDetail = (PlanDetail) dit.next();

            PlanItem aPlanItem = aPlanDetail.getToPlanitem();

 

            ReportDetail aDetail = (ReportDetail)
dctx.newObject(ReportDetail.class);

            BeanUtils.copyProperties(aDetail, aPlanItem);

 

            aDetail.setDatetime(new Timestamp(new Date().getTime()));

 

            aDetail.setValue(null);

            aDetail.setPlandetailid(DBHelper.getId(aPlanDetail));

            //aDetail.setToReportgroup(aReportGroup);

            aReportGroup.addToReportdetailArray(aDetail);   <------- error
occurs here

      }

      aReport.addToReportgroupArray(aReportGroup);

 

 


Re: ERROR "No property for arcId toXyz..."

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Jun 29, 2007, at 8:49 AM, David Norwood wrote:

>   BeanUtils.copyProperties(aDetail, aPlanItem);

I suspect this line copes ObjectId from another object, so Cayenne is  
confused about the nature of the object.

Andrus