I have a pretty large system running OJB which works well, but now I am trying 
to internationalize it.  I have a problem.

country->region->local  is the new general object mapping.

Previously in our last release we just had US and the states, but now the 
mapping doesn't seem to work.

The problem is for many countries, there are no regions.  When I go to 
update/insert a record without a region, it is now nulling out the country.  I 
believe this is because OJB requires the region to be non-null.  I do resolve 
references before the update, but where regionId is null there can be no region 
object.

Right now the mapping looks as follow.  I don't map local yet as there is no 
need yet.   I would be interested in knowing if this is possible if region is 
null as well.

I believe what I need is that "NULL" be ok for a key.   I need some guidance on 
what I can do.



Here are the pertinent fields:

---------
    ... lots of other fields

    <field-descriptor
        name="countryId"
        column="countryid"
        jdbc-type="CHAR"
    />
    <field-descriptor
        name="regionId"
        column="regionid"
        jdbc-type="CHAR"
    />
    <field-descriptor
        name="localId"
        column="localid"
        jdbc-type="CHAR"
    />

    <reference-descriptor
            name="country"
            class-ref="com.jb.sp.model.places.CountryVO"
            auto-retrieve="true"
            auto-update="link"
            auto-delete="none"
            proxy="false">
        <foreignkey field-ref="countryId"/>
    </reference-descriptor>

    <reference-descriptor
            name="region"
            class-ref="com.jb.sp.model.places.RegionVO"
            auto-retrieve="true"
            auto-update="link"
            auto-delete="none"
            proxy="false">
        <foreignkey field-ref="countryId"/>
        <foreignkey field-ref="regionId"/>
    </reference-descriptor>

---------

<class-descriptor class="com.jb.sp.model.places.CountryVO" table="country">
        <field-descriptor name="countryId" column="CountryCode" 
jdbc-type="CHAR" primarykey="true"/>
        <field-descriptor name="name" column="CountryName" jdbc-type="VARCHAR"/>
</class-descriptor>


<class-descriptor class="com.jb.sp.model.places.RegionVO" table="region">
    <field-descriptor name="countryId" column="SUCountry" jdbc-type="CHAR" 
primarykey="true"/>
        <field-descriptor name="regionId" column="SUCode" jdbc-type="CHAR" 
primarykey="true"/>
        <field-descriptor name="name" column="SUName" jdbc-type="VARCHAR"/>
</class-descriptor>





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

Reply via email to