Why i alway get a null value in the database of the dependent object?

i created an object and setXXX to the property then call a insert function 
like this to insert all the information to database.


public boolean insert(Object obj){
  try {
    db.begin();
    db.create(obj);
    db.commit();
    db.close();
    return true;
       }
  catch (Exception e)
    {
     e.printStackTrace();
      return false;
    }
  }


<mapping>

  <!--  Mapping for Stock-->
  <class name="store.Stock"
         identity="id"
        key-generator="MAX">
<cache-type type="count-limited" capacity="200"/>



    <map-to table="Stock" />
    <field name="id" type="integer">
      <sql name="id" type="integer"/>
    </field>

    <field name="name" type="string">
      <sql name="name" type="varchar"/>
    </field>
    <field name="description" type="string">
      <sql name="description" type="varchar"/>
    </field>
    <field name="detail" type="store.StockDetail"
           required="true" collection="arraylist" direct="false" 
lazy="false">
      <sql name="detailid" dirty="check" />

    </field>
</class>

<!--  Mapping for StockDetail -->
  <class name="store.StockDetail"
         identity="id"
         depends="store.Stock"
         key-generator="MAX">


         <cache-type type="count-limited" capacity="200"/>


    <map-to table="stockdetail" />
    <field name="id" type="integer">
      <sql name="id" type="integer"/>
    </field>

    <field name="stock" type="store.Stock"
           required="true" direct="false" lazy="false">
      <sql name="stockid" dirty="check" />



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

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

Reply via email to