Good morning/evening,
  
  I'm trying to get the basics working in order to recommend Castor for this
new project.  I have the select/create/update working for long transaction
but apparently when I insert a new child in a 1 to many relationship, I
update and everything seem fine but when I look at the database I don't see
the child inserted.  I can update existing children fine but can not create
them.
  
  I'm using the cvs version, and I did obtain it from a cvs client and not
thesnapshot.
  
Thank for any help you may provide.
    
  
Here is a quick look at the design:
  
all the classes extends DBObject which is also where I implement the
TimeStampable interface.  DBObject contains the keys and user/date stamp for
all records.
  
  
Identification and Personal depends on Person;
Address and Phone depends on DBObject;
  
The reason I have Address and Phone depends on DBObject is because they can
be aggregated by other objects which extends DBObject, such as a Company.
  
I wanted to prevent having tables 
PERSON, PERSON_CELLPHONE, PERSON_ADDRESS and PERSON_ADDRESS_PHONE;
COMPANY, COMPANY_ADDRESS and COMPANY_ADDRESS_PHONE;
  
   ____________
   |          |
   | DBObject |
   |__________|
      1 ^  ^ 1
        |  |
        |  |_____________________
        |1                      | 1
   _____|______         ________|_________ 
   |          | 1     1 |                |
   | Person   |-------->| Identification |
   |__________|   |     |________________|
                  |
                  |
                  |
                  |     __________________
                  |   1 |                |
                  ----->|    Personal    |->DBObject
                  |     |________________|
                  |
                  |
                  |     __________________
                  |   * |                |
                  ----->|     Address    |->DBObject
                  |     |________________|
                  |             | 1
                  |             |
                  |             |
                  |             |     __________________
                  |             |   * |                |
                  |             ----->|     Phone      |->DBObject
                  |                   |________________|
                  |
                  |
                  |     __________________
                  |   * |                |
                  ----->|     Phone      |->DBObject  
                        |________________|
  
  
Here is a piece of the mapping file:
  
  <!-- Table: DBOBJECT-->
        <class name="isMan.base.DBObject" identity="key"
               key-generator="SEQUENCE">
          <description>Master Object</description>
          <map-to table="DBOBJECT" xml="DBObject"/>  
          <field name="key" type="integer">                      
            <sql name="DBOKEY" type="integer"/>
            <bind-xml node="attribute"/>
          </field>
          <field name="keyType" type="integer">
            <sql name="KEYTYPE" type="integer"/>
            <bind-xml node="attribute"/> 
          </field>
          <field name="parentKey" type="integer">
            <sql name="PARENTKEY" type="integer"/>
            <bind-xml node="attribute"/>
          </field>
        </class>
  
  <!-- Table: PERSON -->
       <class name="isMan.base.person.Person" 
              extends="isMan.base.DBObject" identity="key">
          <description>Person</description>
          <map-to table="PERSON" xml="Person"/>  
          <field name="key" type="integer" >
            <sql name="PERSONKEY" type="integer"/>
            <bind-xml node="attribute"/>
          </field>
          <field name="lastName" type="string">
            <sql name="LASTNAME" type="char"/>
            <bind-xml node="element"/>
          </field>
          <!-- identification -->
          <field name="identification" type="isMan.base.Identification">
            <sql name="IDKEY"/>
            <bind-xml name="identification" node="element"/>
          </field>
          ...
          <!-- mobile phones -->
          <field name="mobilePhones" type="isMan.base.Phone"
                 collection="collection">
            <sql many-key="PARENTKEY"/>
            <bind-xml name="mobilePhone" node="element"/>
          </field>
          ...
        </class>
  
  <!-- Table: IDENTIFICATION -->
        <class name="isMan.base.Identification" 
               extends="isMan.base.DBObject"  
               depends="isMan.base.person.Person" identity="key">
          <description>Person identification</description>
          <map-to table="IDENTIFICATION" xml="Identification"/>  
          <field name="key" type="integer">
            <sql name="IDKEY" type="integer"/>
            <bind-xml node="attribute"/>
          </field>
          <field name="nationalId" type="string" required="true">
            <sql name="NATIONALID" type="char"/>
            <bind-xml node="element"/>
          </field>
          ...
        </class>
  
  <!-- Table: ADDRESS -->
        <class name="isMan.base.Address" 
               extends="isMan.base.DBObject" 
               depends="isMan.base.DBObject" identity="key">
          <description>Person or Company Address</description>
          <map-to table="ADDRESS" xml="Address"/>  
          <!-- +++++++++++++++++++++++++++++++++ --> 
          <field name="key" type="integer">
            <sql name="ADDRESSKEY" type="integer"/>
            <bind-xml node="attribute"/>
          </field>
          <field name="parentKey" type="integer">
            <sql name="PARENTKEY" type="integer"/>
            <bind-xml node="attribute"/>
          </field>
          ...
          <!-- Phones -->
          <field name="phones" type="isMan.base.Phone"
  collection="collection">
            <sql many-key="PARENTKEY"/>
            <bind-xml name="phones" node="element"/>
          </field>
        </class>
  
  
  <!-- Table: PHONE -->
        <class name="isMan.base.Phone" 
               extends="isMan.base.DBObject"
               depends="isMan.base.DBObject" identity="key">
          <description>Person or Company Phone</description>
          <map-to table="PHONE" xml="Phone"/>  
          <!-- +++++++++++++++++++++++++++++++++ --> 
          <field name="key" type="integer" >
            <sql name="PHONEKEY" type="integer"/>
            <bind-xml node="attribute"/>
          </field>
          <field name="parentKey" type="integer">
            <sql name="PARENTKEY" type="integer"/>
            <bind-xml node="attribute"/>
          </field>
          ...
        </class>
  





_______________________________________________________
http://inbox.excite.com

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

Reply via email to