One to Many Relationships

"Kertis, Dennis" <[email protected]> Tue, 17 Aug 2004 14:54:41 -0400
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
I am trying to define a one-to-many relationship in XML.  However, I am
getting the following error:

 

Object: Relationship Category.topics

------------------------------------

 * Error(s):

   - relationship is not mandatory but source attribute Category.id is
required

 

Can anyone tell me the correct way to model a one-to-many with Modeling?  My
"many" table has a foreign key to the primary key of my "one" table, but
modeling doesn't seem to like this.

 

Below is a cutdown of my model.

 

<entity

            name='Topic'>

            <primaryKey attributeName='id'/>

            <attribute 

                  name='id'

                  type='int'

                  isRequired='1'/>

            <attribute 

                  name='categoryID'

                  type='int'

                  isRequired='1'/>

</entity>

<entity

      name='Category'

<primaryKey attributeName='id'/>

      <attribute 

                  name='id'

                  type='int'

                  isClassProperty='0' 

                  isRequired='1'/>

     <relation 

                  name='topics'

                  destinationEntity='Topic'>

                  <join 

                        sourceAttribute='id'

                        destinationAttribute='categoryID'/>

</relation>

</entity>