Hi again,

Plummer, Greg wrote:

Hi Armim,

Thanks for the quick reply.

batch-mode is false.

Here's my DB definition:

<jdbc-connection-descriptor
        jcd-alias="ADMSTDDE"
        default-connection="fase"
==> typo?
        platform="db2"
        jdbc-level="1.0"
        driver="COM.ibm.db2.jdbc.app.DB2Driver"
        protocol="jdbc"
        subprotocol="db2"
        dbalias="DB2T"
        username="*********"
        password="**********"
        batch-mode="false">
        <sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
">
        <attribute attribute-name="autoNaming" attribute-value="true"/>
        </sequence-manager>
</jdbc-connection-descriptor>

By the way, I'm using the PersistenceManager directly, not JDO or ODMG.
One more thing to note, when instances of ClientPayrollDeductionPlan
have a value of 0 for the planId field when I read them back in form the
database. Any thoughts?

I think it's a problem caused by the sequence manager
implementation. Can you verify this by change the sequence
manager implementaion in your test (for testing use SequenceManagerInMemoryImpl)?


Is it mandatory for you to use Identity columns?
If not, I think DB2 supports database based sequence generation
(using 'nextval' command). This also allow other applications
to do inserts without corrupt integrity (SequenceManagerNextValImpl).

regards,
Armin


Thanks, Greg


-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Thursday, October 30, 2003 7:55 PM
To: OJB Users List
Subject: Re: Collection in superclass not saving correctly



Hi Greg,


assume you are using SequenceManagerNativeImpl
(or SequenceManagerMySQLImpl). The '-1' value
is a temporary used id. Normally OJB creating
and handling id's before an object was written
to DB. When using identity columns the id can
only be read after the object was stored to DB.

hmm, do you use batch-mode 'true'?

regards,
Armin

Plummer, Greg wrote:


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.PayPlanAssociati
on
"
        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






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


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






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



Reply via email to