Steve Grant wrote:
> 
> Whats wrong with this XML? When set the Object model to complex I get no
> methods in either the item or category peer classes that refer to the
> other - like a getItemsJoinXxx(Criteria).
> 
> <database>
>   <table name="ITEM">
>     <column name="ITEM_ID" required="true" autoIncrement="true"
> primaryKey="true" type="INTEGER"/>
>     <column name="TITLE" size="255" type="VARCHAR"/>
>     <column name="TEXT" size="255" type="VARCHAR"/>
>     <column name="AUTHOR" size="255" type="VARCHAR"/>
>     <column name="DEPT" size="255" type="VARCHAR"/>
>     <column name="URL" size="255" type="VARCHAR"/>
>     <column name="CATEGORY_ID" required="true" type="INTEGER"/>
> 
>    <foreign-key foreignTable="CATEGORY">
>       <reference local="CATEGORY_ID" foreign="CATEGORY_ID"/>
>     </foreign-key>

This should result in BaseItem.getCategory() and
BaseCategory.getItems(Criteria), does it not work?

> 
>   </table>
> 
>   <table name="CATEGORY">
>     <column name="CATEGORY_ID" required="true" autoIncrement="true"
> primaryKey="true" type="INTEGER"/>
>     <column name="BODY" size="255" type="VARCHAR"/>
> 
>     <foreign-key foreignTable="ITEM">
>       <reference local="CATEGORY_ID" foreign="CATEGORY_ID"/>
>     </foreign-key>

I do not understand this.  I have always used foreign keys to refer to
primary keys in other tables.  What does it mean to have a foreign key A
reference a foreign key B column in another table where B is a reference
back to A?

So for Cat. A to exist there must be at least one item in Cat. A.  I am
not sure you can enforce this in the db as one of them must exist before
the other.  Or is such behavior allowed within a transaction?

You need to explain to me what you are after. 

> 
>   </table>
> </database>
>


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to