Hi all,
Can anyone post a summary/example of how to do many to many mappings?
I'm struggling to get it to go. I've included the relevant sections
from my datamap below. I'm not sure if the datamap is completely
correct.
I try to add a new link from a GeoArea to a Store with the following
code:
Store st = (Store) sIter.next();
StoreArea stArea = (StoreArea)
ctxt.createAndRegisterNewObject("StoreArea");
stArea.setToArea(area);
stArea.setToStore(st);
area.addToStoreAreaArray(stArea);
and then I get the exception:
Primary Key autogeneration only works for a single attribute.
Any ideas?
Thanx for any input
reinier
------ cut here -------------------------------------------------------
<db-entity name="GEOAREA">
<db-attribute name="GEOAREA_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="11"/>
<db-attribute name="NAME" type="VARCHAR" isMandatory="true"
length="50"/>
</db-entity>
<db-entity name="STORE">
<db-attribute name="DESCRIPTION" type="VARCHAR" length="255"/>
<db-attribute name="KSA_NUMBER" type="VARCHAR" length="10"/>
<db-attribute name="NAME" type="VARCHAR" isMandatory="true"
length="255"/>
<db-attribute name="OPENING_DATE" type="DATE"/>
<db-attribute name="STORE_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="11"/>
</db-entity>
<db-entity name="STORE_AREA">
<db-attribute name="THE_AREA" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
<db-attribute name="THE_STORE" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
</db-entity>
<obj-entity name="GeoArea" className="clabo.kfc.domain.GeoArea"
dbEntityName="GEOAREA">
<obj-attribute name="name" type="java.lang.String"
db-attribute-name="NAME"/>
</obj-entity>
<obj-entity name="Store" className="clabo.kfc.domain.Store"
dbEntityName="STORE">
<obj-attribute name="description" type="java.lang.String"
db-attribute-name="DESCRIPTION"/>
<obj-attribute name="ksaNumber" type="java.lang.String"
db-attribute-name="KSA_NUMBER"/>
<obj-attribute name="name" type="java.lang.String"
db-attribute-name="NAME"/>
<obj-attribute name="openingDate" type="java.util.Date"
db-attribute-name="OPENING_DATE"/>
</obj-entity>
<obj-entity name="StoreArea" className="clabo.kfc.domain.StoreArea"
dbEntityName="STORE_AREA">
</obj-entity>
------ cut here -------------------------------------------------------
-- Reinier Mostert <rendie..labo.co.za>
This archive was generated by hypermail 2.0.0 : Fri Jun 06 2003 - 19:50:26 EDT