hi oli, ludovic,

sorry, i missed this post.

as oli mentioned, we need at least two field-conversions. this is true for single-field-pks. imo we need one fc for _each_ field participating in the relationship.

jakob

[EMAIL PROTECTED] schrieb:
Hello Ludovic,

(I guess there are some accents missing on your name - sorry for that),

thank you for your quick answer.


-----Original Message-----
From: Ludovic Maitre (POP - Factory Part)


I have found a way to workaround the problem without modifying the code.
However, that workaround does not work for OJB 1.0.0, but it works
for builds younger than 3 weeks or so: I you my own IdentityFactory,
which extens IdentityFactoryImpl and invokes the correct FieldConversion.

Of course, a fix is nevertheless desireable.  See my comments below.


protected void associateBatched(Collection owners, Collection children, Collection mToNImplementors)
{
//LMA: Use a field conversion if necessary
//[Solve the potential problem described above]
FieldConversion fc = cds.getClassDescriptor().getPrimaryKey().getFieldConversion();


here, you need at at least two FieldConversions, say:
fc[0] = getOwnerClassDescriptor().getPrimaryKey().getFieldConversion();
fc[1] = getItemClassDescriptor().getPrimaryKey().getFieldConversion();

In case of composed primary keys, you need an array
FieldConversion[] fc of size ownerPkLen + childPkLen
where the latter are as below

[..]


int ownerPkLen = getOwnerClassDescriptor().getPkFields().length;
int childPkLen = getItemClassDescriptor().getPkFields().length;


//LMA: Use the field conversion if it exist. We assume that the pk of the 2 objects are of the same type.


dangerous assumption (but true for my project, too)


           //[solve the potential problem described by BRJ]
           if (fc!=null)
                   for (int i=0;i<mToN.length;i++)
                       mToN[i]=fc.sqlToJava(mToN[i]);


here, you would need fc[i] rather than that single fc, am I right?

Hm.  I wonder whether I should apply that change ...

Olli

---------------------------------------------------------------------
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