Re: Unable to generate addTo... and removeFrom... methods

From: Mike Kienenberger (mkienen..mail.com)
Date: Wed Aug 31 2005 - 12:35:48 EDT

  • Next message: Gili: "CASCADE support?"

    Doh!
    Yeah.
    I knew it was something simple like that, which is why I asked :)

    Yes, I mistakenly marked them as to-many.

    On 8/31/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > Mike, the reason for that is that relationship is treated as read-
    > only. Maybe because these two relationships FROM a join table are
    > marked as to-many while they should be to-one?
    >
    > Andrus
    >
    >
    > > <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
    > > target="CONTENT" toMany="true">
    > > <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
    > > </db-relationship>
    > >
    > > <db-relationship name="announcementList"
    > > source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
    > > <db-attribute-pair source="ANNOUNCEMENT_ID"
    > > target="ANNOUNCEMENT_ID"/>
    > > </db-relationship>
    >
    >
    >
    >
    >
    > On Aug 31, 2005, at 12:27 PM, Mike Kienenberger wrote:
    >
    > > I'm trying to set up some flattened relationships in a new project and
    > > data map using the modeler, and I'm having some problems.
    > >
    > > Generated classes (from the modeler) isn't creating the addTo... and
    > > removeFrom... methods. Actually, neither is running it from the ant
    > > cgen task.
    > >
    > > My other project has similar relationships (although I can't remember
    > > if I made the join table with dependent primary keys) and the methods
    > > are generating without problem.
    > >
    > > -Mike
    > >
    > >
    > > <?xml version="1.0" encoding="utf-8"?>
    > > <data-map project-version="1.1">
    > > <property name="defaultLockType" value="optimistic"/>
    > > <property name="defaultPackage"
    > > value="com.gvea.announcement.entity"/>
    > > <property name="defaultSuperclass"
    > > value="com.gvea.cayenne.BaseDataObject"/>
    > > <db-entity name="ANNOUNCEMENT">
    > > <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
    > > isPrimaryKey="true" isMandatory="true"/>
    > > [...]
    > > </db-entity>
    > > <db-entity name="ANNOUNCEMENT__CONTENT">
    > > <db-attribute name="ANNOUNCEMENT_ID" type="NUMERIC"
    > > isPrimaryKey="true" isMandatory="true"/>
    > > <db-attribute name="CONTENT_ID" type="NUMERIC"
    > > isPrimaryKey="true"
    > > isMandatory="true"/>
    > > </db-entity>
    > > <db-entity name="CONTENT">
    > > <db-attribute name="CONTENT_ID" type="NUMERIC"
    > > isPrimaryKey="true"
    > > isMandatory="true"/>
    > > [...]
    > > </db-entity>
    > >
    > > <obj-entity name="Announcement"
    > > className="com.gvea.announcement.entity.Announcement"
    > > lock-type="optimistic" dbEntityName="ANNOUNCEMENT"
    > > superClassName="com.gvea.cayenne.BaseDataObject">
    > > [...]
    > > </obj-entity>
    > > <obj-entity name="Content"
    > > className="com.gvea.announcement.entity.Content"
    > > lock-type="optimistic" dbEntityName="CONTENT"
    > > superClassName="com.gvea.cayenne.BaseDataObject">
    > > [...]
    > > </obj-entity>
    > >
    > > <db-relationship name="contentJoinList" source="ANNOUNCEMENT"
    > > target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
    > > <db-attribute-pair source="ANNOUNCEMENT_ID"
    > > target="ANNOUNCEMENT_ID"/>
    > > </db-relationship>
    > >
    > > <db-relationship name="announcementList"
    > > source="ANNOUNCEMENT__CONTENT" target="ANNOUNCEMENT" toMany="true">
    > > <db-attribute-pair source="ANNOUNCEMENT_ID"
    > > target="ANNOUNCEMENT_ID"/>
    > > </db-relationship>
    > >
    > > <db-relationship name="contentList" source="ANNOUNCEMENT__CONTENT"
    > > target="CONTENT" toMany="true">
    > > <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
    > > </db-relationship>
    > >
    > > <db-relationship name="announcementList"
    > > source="ANNOUNCEMENT__VIEWPOINT" target="ANNOUNCEMENT" toMany="true">
    > > <db-attribute-pair source="ANNOUNCEMENT_ID"
    > > target="ANNOUNCEMENT_ID"/>
    > > </db-relationship>
    > >
    > >
    > > <db-relationship name="announcementJoinList" source="CONTENT"
    > > target="ANNOUNCEMENT__CONTENT" toDependentPK="true" toMany="true">
    > > <db-attribute-pair source="CONTENT_ID" target="CONTENT_ID"/>
    > > </db-relationship>
    > >
    > > <obj-relationship name="contentList" source="Announcement"
    > > target="Content" deleteRule="Cascade"
    > > db-relationship-path="contentJoinList.contentList"/>
    > >
    > > </data-map>
    > >
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Aug 31 2005 - 12:35:50 EDT