Zhuang,

 When you change a relationship value, the DAS does not allow you to
also update the foreign key column of the child table. After milestone
2 we added some code to throw an exception when this happens so that
it's more obvious what is going wrong.

Brent

On 1/29/07, zhuang johnyson <[EMAIL PROTECTED]> wrote:
Hello, I am using static data object,   in my configuration file:

   <Table tableName="FM_TEST_CUSTOMER" typeName="Customer">
       <Column columnName="USER_ID" primaryKey="true" />
   </Table>

   <Table tableName="FM_TEST_ORDER" typeName="Order">
       <Column columnName="ORDER_ID" primaryKey="true" />
   </Table>

   <Relationship name="ORDERS" primaryKeyTable="FM_TEST_CUSTOMER"
foreignKeyTable="FM_TEST_ORDER" many="true">
     <KeyPair primaryKeyColumn="USER_ID" foreignKeyColumn="USER_ID" />
   </Relationship>
And I use the static DataObject codes which generated from tuscany
Tool,so I have Customer static DataObject
 and Order static DataObject,and Customer has a list property ORDERS.

however, when I add a "Order" DataObject:

       SDOUtil.registerStaticTypes(CustomerFactory.class);
       DAS das = DAS.FACTORY.createDAS(test.getConfig("FM_TEST_CUSTOMER.xml"),
getConnection());
       Command selectCommand = das.getCommand("all customers with order");
       DataObject root = selectCommand.executeQuery();
       Customer customer = (Customer)root.getDataObject("Customer[1]");
       Order order = (Order)root.createDataObject("Order");
       order.setUSER_ID(new BigDecimal(2));
       order.setGOOD_ID(new BigDecimal(3));
       customer.getORDERS().add(order);
       das.applyChanges(root);

It will throws an Exception:
  Exception in thread "main" java.lang.RuntimeException:
java.sql.SQLException:invalidation column type
I tracked the source of tuscany, and find it produced a sql:
  update FM_TEST_CUSTOMER set ORDERS = ? where USER_ID = ?

How to resolve this problem??



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to