[baseten-users] ERROR: null value in column "xyz" violates not-null constraint when trying to insert mandatory data

Réjean Lamy rejean.lamy at mac.com
Sat May 23 15:41:07 EEST 2009


Hi Tuukka

About BXDatabaseObjects here http://basetenframework.org/wiki/CreatingObjects 
.

It is mentioned "..the context needs to know about your objects:  
that's why you can't just go and instantiate BXDatabaseObjects on your  
own."
And the recommendation about using createObjectForEntity:entity.

Questions:

May I conclude that unlike CoreData, this is not possible to simply  
instantiate a BXDatabaseObjects, instead we must first create the  
objects as explained ?
Also, I would like to know where is the recommended place in code to  
creates the BXDatabaseObjects (In App Controller -init, -awakeFromNib,  
others...) ?

Thanks

Rejean Lamy

Le 09-05-22 à 08:14, Tuukka Norri a écrit :

> Sascha Gresk kirjoitti 22.5.2009 kello 1.48:
>> Solved ... After watching http://developer.apple.com/cocoa/coredatatutorial/coredata_mov3.html
>> I just gave my Property a "Default Value". Thats an excellent  
>> solution for me, and maybe it is even
>> suitable for the tutorial.
>
> Hi!
> Another option is to create the object using BXDatabaseContext's  
> method -createObjectForEntity:withFieldValues:error: and pass the  
> required value. If you want to create the object using  
> BXSynchronizedArrayController, a default value is needed, since NOT  
> NULL constraint can't be deferred.
> -- 
> Best regards,
> Tuukka Norri
> MK&C
>
>
> _______________________________________________
> baseten-users mailing list
> baseten-users at lists.basetenframework.org
> http://lists.basetenframework.org/mailman/listinfo/baseten-users




More information about the baseten-users mailing list