Jeff,

> In my mapping file, I can specify <class>es with simple type <field>s 
> successfully. However, I was wondering how to do the following two 
> things:
> 
> 1) Specify that a referenced class (also in the mapping) should 
> contribute values to the current row of the table. For example, say I 
> have a class called "MonsterHead" that references a class 
> called "Eyes". 
> Then I have a table called "Monster". In the mapping, I want 
> to specify 
> that both "MonsterHead" and "Eyes" (which is referenced in 
> MonsterHead 
> via a get method) contribute to the values in a single row of the 
> "Monster" table.

Here is the mapping for the class MonsterHead (and Eyes) on the table
'monster':
----------------------------------------------------------------------------
----
  <class  name="MonsterHead"
          identity="id"  key-generator="monster_seq">
    <description>Monster</description>
    <cache-type  type="time-limited" />
    <map-to  table="moster" />
    <field  name="id"            type="integer">
      <sql  name="moster_id"     type="numeric" />
    </field>
    <field  name="description"   type="string">
      <sql  name="description"   type="varchar" />
    </field>

    <field  name="eyes.color"     type="string">
      <sql  name="eyes_color"     type="varchar" />
    </field>
  </class>
----------------------------------------------------------------------------
----

The table 'monster' contains the following columns: {monster_id,
description, eyes_color}


> 2) Specify that an array of a referenced class (also in the mapping) 
> should be inserted into the table. Say I have a class called 
> "MonsterHead" that references an array of a class called 
> "MonsterFriends". Then I have both a "Monster" table and a 
> "MonsterFriends" table. When a "MonsterHead" is put into the 
> database, I 
> want all of its friends to be put there too.

Mmmm, I'm not sure on this last one. who made that RDB any way? This even is
agains
the relational rules! How many columns of monster friends are there? Or is
each
monster instered multiple times with each time a differned friend? It sounds
as if
own of your monster has disgned this monster of a table......


Tjeerd

This e-mail and any attachment is for authorised use by the intended recipient(s) 
only.  It may contain proprietary material, confidential information and/or be subject 
to legal privilege.  It should not be copied, disclosed to, retained or used by, any 
other party.  If you are not an intended recipient then please promptly delete this 
e-mail and any attachment and all copies and inform the sender.  Thank you.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to