Hi All,

I have two mysql tables, Account(id, name, paymentTypeId) and Payment
Type(paymentTypeId, name) where Account has a foreign key to
PaymentType. I put together a mapping file for this (see C.) below).
When I build an OQL Query in my main program ( see A. below), it fails
in the ParseTreeWalker Constuctor call to checkErrors(). I traced the
error into the LockEngine function getClassMolder(). If I just comment
out the line if( !Molder.isDependent ) (see B. below) my program works
fine. If not then I get the error:  

[Test] org.exolab.castor.jdo.QueryException: Could not find mapping for
class com.rock.app.billdemo.Account

Am I mot doing the mappings correctly?

Cheers,
Steve Rock

-------------
A.) [Code that gets executed in main class]
// Fails in this function
accountOql = db.getOQLQuery( "SELECT f FROM
com.rock.app.billdemo.Account f" );
        results = accountOql.execute();
        while ( results.hasMore() ) {
                account = (Account) results.next();
                writer.println( "Found Account: " + account );
        }

-------------
B.) [LockEngine function that I have to modify to get this to work fine]
public ClassMolder getClassMolder( Class cls ) {
        TypeInfo info = (TypeInfo)_typeInfo.get( cls.getName() );
      if ( info != null ) {
                // If I comment out the line below it works fine
            if ( !info.molder.isDependent() )
                return info.molder;
      }
      return null;
}

-------------
C.) [Mappings file into a mysql database]

  <!--  Mapping for PaymentType  -->
  <class name="com.rock.app.billdemo.PaymentType"
        identity="id" key-generator="IDENTITY">
    <description>Payment types that are used to make bill payments
        Examples include cash, credit card, check, money order.
    </description>
    <map-to table="payment_type" xml="payment_type" />
    <field name="id" type="integer">
      <sql name="payment_type_id" type="integer"/>
      <xml/>
    </field>
    <field name="name" type="string">
      <sql name="name" type="char"/>
      <xml node="element" />
    </field>
  </class>



  <!--  Mapping for Account -->
  <class name="com.rock.app.billdemo.Account" identity="id"
depends="com.rock.app.billdemo.PaymentType" key-generator="IDENTITY">
    <description>Product detail</description>
    <map-to table="account" xml="account" />

    <field name="id" type="integer">
      <sql name="account_id" type="integer"/>
      <xml node="attribute"/>
    </field>

    <field name="paymentType" type="com.rock.app.billdemo.PaymentType">
      <sql name="payment_type_id" />
      <xml name="paymentType" node="element" />
    </field>

    <field name="name" type="string">
      <sql name="name" type="char"/>
      <xml node="text" />
    </field>

  </class>

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

Reply via email to