Hi All,

I have a superclass, PayrollDeductionPlan, that contains a collection of
PayPlanAssociation objects. The foreign key in the PayPlanAssociation
table that points back to the PayrollDeductionPlan table is not getting
stored correctly. See the snapshots of the tables below, don't know
where the -1 is coming from.

I have the following (stripped-down) classes, repository.xml entries and
tables. Any help would be greatly appreciated! Thanks in advance.

Greg Plummer



public class PayrollDeductionPlan {

        private List payPlanAssociations = new ArrayList();
        private int planId;
}

public class ClientPayrollDeductionPlan extends PayrollDeductionPlan {

        private int id;
}

public class PayPlanAssociation {
        
        private ClientGroup clientGroup = null;
        private String payCode = null;
        private PayrollDeductionPlan payrollDeductionPlan = null;
}



<class-descriptor
 
class="com.lmig.pm.affinity.model.billing.PayrollDeductionPlan"
          table="DEXA100T">
     <field-descriptor
         name="planId"
         column="PLAN_ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
         access="readonly"
      />
      <collection-descriptor
        name="payPlanAssociations"
 
element-class-ref="com.lmig.pm.affinity.model.billing.PayPlanAssociation
"
        auto-read="true"
        auto-update="true"
        auto-delete="true">
                <inverse-foreignkey field-ref="planId" />
       </collection-descriptor>         
</class-descriptor>

<class-descriptor
 
class="com.lmig.pm.affinity.model.billing.ClientPayrollDeductionPlan"
          table="DEXA070T">
     <field-descriptor
         name="id"
         column="PAYROLL_ID"
         jdbc-type="INTEGER"
         primarykey="true"
         autoincrement="true"
         access="readonly"
      />
     <field-descriptor
         name="planId"
         column="PLAN_ID"
         jdbc-type="INTEGER"
         access="anonymous"
      />
      <reference-descriptor 
        name="super" 
 
class-ref="com.lmig.pm.affinity.model.billing.PayrollDeductionPlan"
        auto-update="true"
        auto-delete="true">
                <foreignkey field-ref="planId"/>
      </reference-descriptor>            
</class-descriptor>

<class-descriptor
          class="com.lmig.pm.affinity.model.billing.PayPlanAssociation"
          table="DEXA210T">
     <field-descriptor
        name="clientGroupId"
        column="CLIENT_GROUP_ID"
                primarykey="true"
        jdbc-type="INTEGER"
        access="anonymous"
      />
      <reference-descriptor
        name="clientGroup"
        class-ref="com.lmig.pm.affinity.model.client.ClientGroup">
                <foreignkey field-ref="clientGroupId"/>
      </reference-descriptor>
      
     <field-descriptor
         name="payCode"
         column="PAYCODE"
         primarykey="true"
         jdbc-type="CHAR"
      />
      
    <field-descriptor
        name="planId"
        column="PLAN_ID"
        jdbc-type="INTEGER"
        access="anonymous"
      />
      <reference-descriptor
        name="payrollDeductionPlan"
 
class-ref="com.lmig.pm.affinity.model.billing.PayrollDeductionPlan">
                <foreignkey field-ref="planId"/>
      </reference-descriptor> 
</class-descriptor>


DEXA100T (PayrollDeductionPlan table):
PLAN_ID NAME
70              Plan Name


DEXA070T (ClientPayrollDeductionPlan table):
PAYROLL_ID      PLAN_ID
26              70


DEXA210T (PayPlanAssociation table):
CLIENT_GROUP_ID PLAN_ID PAYCODE
141                     -1              AC              

Reply via email to