I solved my trouble by update to RC4 and to unload the last P6Spy
version.....This one is bugged !!

Thanks for your helps !



-----Message d'origine-----
De�: Jakob Braeuchi [mailto:[EMAIL PROTECTED] 
Envoy�: mercredi 15 octobre 2003 14:50
��: OJB Users List
Objet�: Re: RE : How to map optional 1:1 relationship

salut emmanuel,

imo the problem is not the sql. ojb will not 'null' the fk if it's a 
primitive.

from class PersistentFieldDirectAccessImpl:

     public void doSet(Object obj, Object value) throws MetadataException
     {
         Field fld = getField();
         Class type = fld.getType();
         try
         {
             /**
              * MBAIRD
              * we need to be able to set values to null. We can only 
set something to null if
              * the type is not a primitive (assignable from Object).
              */
             // thanks to Tomasz Wysocki for this trick
             if ((value != null) || !type.isPrimitive())
             {
                 fld.set(ProxyHelper.getRealObject(obj), value);
             }
         }
...

jakob

Emmanuel Dupont wrote:

> Jakob,
> 
> What about the fact that the insert statement add a '' value in place of
the
> nullable FK ?
> 
> No '' should be done.
> 
> Sample :
> 
> INSERT INTO A (Apk, Bfk) VALUES (�100�,��);
> 
> It should be :
> 
> INSERT INTO A (Apk) VALUES (�100�);
> 
> When Bfk is nullable and no value has been set.
> 
> Isn't it ?
> 
> 
> 
> -----Message d'origine-----
> De : Jakob Braeuchi [mailto:[EMAIL PROTECTED] 
> Envoy� : mercredi 15 octobre 2003 14:22
> � : OJB Users List
> Objet : Re: How to map optional 1:1 relationship
> 
> hi olli, carl,
> 
> you should try to avoid primitives for fk columns. when you disconnect 
> the reference ojb will not be able to correctly set the fk to null when 
> using primitives ! later when loading the parent object it may contain a 
> fk to a non materializable proxy.
> 
> the samples are not a good reference here :(
> 
> jakob
> 
> [EMAIL PROTECTED] wrote:
> 
> 
>>Hello,
>>
>>
>>
>>>-----Original Message-----
>>>From: Boyes, Carl [mailto:[EMAIL PROTECTED]
>>
>>
>>>I've currently
>>>mapped it as a 1:1, but the when the foreign key reference is 
>>>null an extra sql statement with a where condition of 
>>>     fkey = ''
>>>is generated.
>>
>>
>>this question has been asked fairly often
>>(for example by myself).  See e.g. thread
>>"Null references and proxies".
>>
>>The solution is to use java reference types
>>as foreign key fields (unlike in the OJB 
>>examples / junit tests), Integer instead of int.
>>
>>I can really highly recommend that.
>>
>>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]
> 
> 
> ---------------------------------------------------------------------
> 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