thank you for the reply .. yes I am using the CVS
version 
here is the code .. it is basically taken from the
examples .. I am rather new to castor 

public class InvoiceTest {
        public static final String DatabaseFile =
"database.xml";
        public static final String MappingFile =
"map.xml";
        private Mapping  _mapping;
        private JDO      _jdo;

        public static void main(String[] args) {
        PrintWriter    writer;
        InvoiceTest   test;
        writer = new Logger( System.out).setPrefix("test");
        try{
                test = new InvoiceTest(writer);
                test.run(writer);
        }catch ( Exception except ) {
                writer.println( except );
        except.printStackTrace( writer );
                }
        }       

public InvoiceTest ( PrintWriter writer ){}

  public void run( PrintWriter writer )
        throws Exception
  {
        Database      db;
        OQLQuery     invoiceOql;
        OQLQuery     methodOql;
        QueryResults  results;

        Invoice invoice=null;
        invoice = Invoice.unmarshal(new
FileReader("invoice_min.xml));
        String name = invoice.getName();
        String id = invoice.getCustId();
        ShippingMethod method =
invoice.getShippingMethod();
        int methodid = method.getId();
        Date date = invoice.getShippingDate();
        Time time = invoice.getShippingTime();
         
        _mapping = new Mapping(
getClass().getClassLoader() );
        _mapping.setLogWriter( writer );
        _mapping.loadMapping( getClass().getResource(
MappingFile ) );
        
        _jdo = new JDO();
        _jdo.setLogWriter( writer );
        _jdo.setConfiguration( getClass().getResource(
DatabaseFile ).toString() );
        _jdo.setDatabaseName( "invoicetest" );

        db = _jdo.getDatabase();
        db.begin();

        invoice = new Invoice();
        invoice.setCustId( id );
        invoice.setName( name );
        invoice.setShippingDate(date);
        invoice.setShippingTime(time);
        db.create(invoice);
        db.commit();
        db.close();
     }
} 
        
        
        
         

 
        




        




        
        
               







--- Arnaud Blandin <[EMAIL PROTECTED]> wrote: > Hi
Sayed,
> 
> Are you using the CVS version of Castor?
> If yes can you send the code you use with the
> mapping file.
> 
> Arnaud
> 

>  

__________________________________________________
Do You Yahoo!?
Yahoo! Mobile - Jazz up your mobile phone!  Get funky ringtones and logos!
http://mobile.yahoo.com.sg/

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

Reply via email to