db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guido Beutler" <guido.beut...@hrs.de>
Subject Re: Null Value generated if auto-retrieve set to false
Date Thu, 01 Apr 2004 14:11:57 GMT
Hi Armin,

works great. Thanks very much :-)

As you could see from my mail I started moving from primitives to objects.
Your performance argument for 1:n is a very strong one.
The null value problem was a side effect of my work.

best regards,

Guido

Armin Waibel wrote:

> Hi Guido,
>
> Guido Beutler wrote:
>
>> Hello,
>>
>> I set the auto-retrieve attribute at repository to false for a 1:1 
>> relationship.
>> I need the reference for a query but in most cases I do not want to 
>> read the referenced object.
>>
>> After reading a instance I tried to store the same unmodified object 
>> again.
>> I run into a SQL error during the update statement "can not write 
>> null into not null field".
>> After some debugging I realized that the missing field is the FK 
>> field of not materialized 1:1 reference object.
>>
>
> We do a refactoring of the auto-xxx settings to prevent this problem. 
> In your case set auto-update="none" instead of "false". Please see
> http://db.apache.org/ojb/tutorial3.html#1:1%20auto-xxx%20setting
>
> If you want to use auto-update="object" or "true", then you have to 
> load the reference first, see
> http://db.apache.org/ojb/tutorial3.html#auto-retrieve%20setting
>
> Does this solve you problem?
> By the way, in rc6 is bug when set auto-delete="false", OJB interpret 
> it as "true", so better use "none". It's fixed in CVS.
>
> regards,
> Armin
>
>> If I remove the reference descriptor from the mapping everything 
>> works fine, but my queries won't work.
>> For me it looks like storing an object when auto-retrieve is set to 
>> false fails.
>> I expected that ojb recognize that the auto-retrieve attribute was 
>> set to false and then takes
>> the fk attribute field for the update and not the reference which may 
>> be null (because not retrieved).
>> The fk field is of type Integer. The integer Object is filled with 
>> the correct value.
>>
>> Any idea?
>>
>> best regards,
>>
>> Guido
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Mime
View raw message