Hi,
We have a problem with updating a foreign key. The mapping file looks
like:
<class name="project.Project" identity="oid" access="shared"
key-generator="MAX">
        <description>PROJECT definition</description>   
                <map-to table="PROJECT"/>
                <field name="oid" type="integer">
                        <sql name="PROJECTID" type="integer"
dirty="ignore"/>
                </field>
                <field name="dptNo" type="string">
                        <sql name="DPTNO" type="char" dirty="ignore"/>
                </field>
                <field name="budgetingUnit" type="unit.BudgetingUnit">
                        <sql name="BUDGETINGUNIT" dirty="ignore"/>
                </field>                
        </class>

The field "budgetingUnit" is a reference to another Class.
If I update the field "dptNo" which is of type String, everything is
fine. But if I update the reference, "budgetingUnit" only, the reference
is not set in the database, although I can see the update in the
application. But of course this means that the change will no longer be
present when the web application is shutdown.

The code looks like this:

Database db=jdo.getDatabase(); 
db.setAutoStore(true);
db.begin();
Project project= ... retrieve instance using OQL...
project.setDptNo(dptNoStr);
BudgetingUnit budgetingUnit = ...retrieve instance using OQL...
project.setBudgetingUnit(budgetingUnit);
db.commit();
db.close();

Now, if the String field is changed, the database is updated. But if
*only* the reference field "budgetingUnit" is changed, the cache is
updated but the database is not updated. If both fields are changed,
then the database is updated for both.

I hope that I could explain my problem well. Help will be very much
appreciated.

Thanks in advance,
Turgay Zengin



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

Reply via email to