Re: NullPointerException on non-null attribute
Re: NullPointerException on non-null attribute
- Subject: Re: NullPointerException on non-null attribute
- From: Chuck Hill <email@hidden>
- Date: Wed, 14 Nov 2012 09:21:15 -0800
Also the EOModel checks are only enforced when saveChanges() runs. So it is possible that a bug in your code is setting these to null before you try to use them.
Chuck
On 2012-11-14, at 9:16 AM, Ramsey Gurley wrote:
>
> On Nov 14, 2012, at 8:54 AM, Maik Musall wrote:
>
>> Hi,
>>
>> occasionally I get a NullPointerException on an attribute of a fetched EO that is
>> * set to not nullable in EOModel
>> * guarded to be not null by a NOT NULL constraint in the database
>> * and actually has a value there.
>>
>> This happens with both simple values like BigDecimals, as well as with relationships.
>>
>> Any idea what could cause that or what I could do to nail it down?
>>
>> Thanks
>> Maik
>
> I have seen that in apps that violate the commandments:
>
> http://wiki.wocommunity.org/pages/viewpage.action?pageId=1050329
>
> If relationships are going missing and you are using nested ECs you may want to try
>
> ec.setRetainsRegisteredObjects(true)
>
> There's a known bug where EOs can be GCed which can result in nulls coming from required relationships. Nobody has managed to fix it in wonder yet.
>
> Ramsey
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden