Kertis, Dennis
2004-08-18 04:03:02 UTC
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>
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>