Hi,

I am using the PB-API and struggle with update fk references in the db.

There are three tables Person --> Activity --> Schedule.
Person has a 1:N assoc to Activity. Activity has a 1:N assoc to Schedule.

While you plan the schedule you have to select a person which will be
assigned to the selected activity. For the first time,
doing an insert works well. If you want to change the person, an update
fails. There is no error message though, everything
seems fine. I tested it by setting some values and did an update to the db.
All values had been updated, except the
fk for personid in table Activity. Here are the facts:

Activity holds a fk for table Person. Schedule holds a fk for table
Activity. The repository excerpt is as follows:

<!-- table TPPERSON -->
<class-descriptor class="de.premiere.plato.app.person.entity.PersonModel"
table="PLATO.TPPERSON" >
        <field-descriptor id="1"        name="intPersonId"
column="PERSON_ID"  jdbc-type="INTEGER" primarykey="true"
autoincrement="true" access="readonly" />
        ...
    <collection-descriptor
        name="allAssignedActivities"
        element-class-ref="de.plato.activity.entity.ActivityModel"

        orderBy="intActivityId"
        sort="DESC"

        auto-retrieve="true"
        auto-update="true"
        auto-delete="true" >

            <inverse-foreignkey field-ref="intPersonId" />
    </collection-descriptor>
</class-descriptor>


<!-- TPACTIVITY -->
<class-descriptor class="de.plato.app.activity.entity.ActivityModel"
table="PLATO.TPACTIVITY" >
        <field-descriptor id="1"        name="intActivityId"
column="ACTIVITY_ID"            jdbc-type="INTEGER" primarykey="true"
autoincrement="true" access="readonly" />
        ...
        <field-descriptor id="8"        name="intPersonId"
column="PERSON_ID"              jdbc-type="INTEGER" />
        ...
        <reference-descriptor name="personModel"
                class-ref="de.premiere.plato.app.person.entity.PersonModel"
                refresh="true"

                auto-retrieve="true"
                auto-update="true"  >

                <foreignkey field-id-ref="8" />
        </reference-descriptor>

        <collection-descriptor
                name="allAssignedSchedules"
        
element-class-ref="de.plato.app.schedule.entity.ScheduleModel"
                orderBy="intScheduleId"
                sort="DESC"

                auto-retrieve="true"
                auto-update="true"
                auto-delete="true" >

            <inverse-foreignkey field-ref="intActivityId" />
    </collection-descriptor>
</class-descriptor>


<!-- TPSSCHEDULE -->
<class-descriptor
class="de.premiere.plato.app.schedule.entity.ScheduleModel"
table="PLATO.TPSCHEDULE" >
        <field-descriptor id="1"        name="intScheduleId"
column="SCHEDULE_ID"        jdbc-type="INTEGER" primarykey="true"
autoincrement="true" access="readonly" />
        ...
        <field-descriptor id="11"       name="intActivityId"
column="ACTIVITY_ID"       jdbc-type="INTEGER" />
    <reference-descriptor name="activity"
                class-ref="de.plato.app.activity.entity.ActivityModel"
                refresh="true"

                auto-retrieve="true" >

                <foreignkey field-id-ref="11" />
        </reference-descriptor>
</class-descriptor>


The pk's are primitive integers. I just store the collection
'allAssignedSchedules' in a
while loop with broker.store(scheduleObject). Again, this works well for all
attributes except the fk of personId in
table Activity. I do not why. Does someone have an idea?

thx,
Dirk 


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

Reply via email to