Hi Steve,
Just from looking at your mapping, what I think confuses Cayenne (and
confuses me as well), is the fact that the relationship "whitelist ->
org" doesn't point to the primary key (id), but rather points to
another column (shortName). Any reason why you don't want to create
"whitelist.orgId" column that points to org.id?
Thanks
Andrus
On Feb 2, 2004, at 12:47 AM, Steve Wells wrote:
> My datamodel is basically a 1 to many:
> Whitelist (a list of valid email suffixs for an Org) - The many side
> <db-entity name="whitelist" catalog="lgo">
> <db-attribute name="emailSuffix" type="VARCHAR" isMandatory="true"
> length="120"/>
> <db-attribute name="id" type="INTEGER" isPrimaryKey="true"
> isMandatory="true" length="11"/>
> <db-attribute name="orgName" type="VARCHAR" isMandatory="true"
> length="20"/>
> </db-entity>
>
> Org - An organisation - the one side
> <db-entity name="org" catalog="lgo">
> <db-attribute name="id" type="INTEGER" isPrimaryKey="true"
> isMandatory="true" length="11"/>
> <db-attribute name="shortName" type="VARCHAR" isMandatory="true"
> length="20"/>
> </db-entity>
>
> The relationships:
> <db-relationship name="toOrg" source="whitelist" target="org"
> toDependentPK="false" toMany="false">
> <db-attribute-pair source="orgName" target="shortName"/>
> </db-relationship>
> <db-relationship name="toWhitelist" source="org" target="whitelist"
> toDependentPK="false" toMany="true">
> <db-attribute-pair source="shortName" target="orgName"/>
> </db-relationship>
> <obj-relationship name="toOrg" source="Whitelist" target="Org"
> toMany="false">
> <db-relationship-ref source="whitelist" target="org" name="toOrg"/>
> </obj-relationship>
> <obj-relationship name="toWhitelist" source="Org" target="Whitelist"
> toMany="true">
> <db-relationship-ref source="org" target="whitelist"
> name="toWhitelist"/>
> </obj-relationship>
This archive was generated by hypermail 2.0.0 : Mon Feb 02 2004 - 01:27:53 EST