Re: Problem with Primary Keys (I think)
Re: Problem with Primary Keys (I think)
- Subject: Re: Problem with Primary Keys (I think)
- From: Johnny Miller <email@hidden>
- Date: Wed, 20 Feb 2013 16:07:14 -1000
Do you think I should try locking the child editing context through the wizard and only unlock it after the save changes is made on the parent?
On Feb 20, 2013, at 3:50 PM, Chuck Hill <email@hidden> wrote:
> Should be able to keep it locked.
>
> Hmmm, that child EC might be contributing to this. I recall a discussion of some problems. The details are not coming to me.
>
>
>
> Chuck
>
> On 2013-02-20, at 5:46 PM, Johnny Miller wrote:
>
>> OK. So on this particular type of EO it always goes through a wizard where I use a parent & child editing context.
>>
>> Do I need to unlock/lock before I save changes on every step?
>>
>> On Feb 20, 2013, at 3:08 PM, Chuck Hill <email@hidden> wrote:
>>
>>>
>>> On 2013-02-20, at 5:05 PM, Johnny Miller wrote:
>>>
>>>> I can't figure out why it's talking to this EO at all. It should be creating a new EO not modifying an existing one.
>>>
>>> That is EXACTLY what happens when things are not locked properly. The EC processes a notification and basically goes insane, losing track of which objects are inserted, updated, etc.
>>>
>>>
>>> Chuck
>>>
>>>
>>>>
>>>> On Feb 20, 2013, at 3:00 PM, Ken Anderson <email@hidden> wrote:
>>>>
>>>>> What is the code doing to the object that's being modified?
>>>>>
>>>>> On Feb 20, 2013, at 5:56 PM, Johnny Miller <email@hidden> wrote:
>>>>>
>>>>>> Hi Ken,
>>>>>>
>>>>>> Sure - The XXXs represent information that I stripped for customer privacy.
>>>>>>
>>>>>> So the EO that is getting changed exists in the DB and it is not created by the app that is throwing the error. The DB is using sequences to track the primary keys. I'm not doing anything other than using the defaults. The error is it cannot set the hub_id to null which should fail validation on both the EO and the DB. Why it is trying to do that is the mystery to me.
>>>>>>
>>>>>> Thanks a lot,
>>>>>>
>>>>>> Johnny
>>>>>>
>>>>>> com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression failed: : Next exception:SQL State:23502 -- error code: 0 -- msg: ERROR: null value in column "hub_id" violates not-null constraint Detail: Failing row contains (null, 0, 0, 1111852918, 2013-02-20 06:00:45.343-10, XXXXXXXXX, XXXXXXXXXX, null, null, null, 0, null, 7171, 0, 2013-02-20 06:00:45.343, 2, 2013-04-12 11:05:00-10, 2, 6, 0, null, 149, 9, XXXXXXXXX, 0.00, null, null, 55.00, 11.00, null, 2, 0, 0, 0, 0, XXXXXX, 2013-04-12 11:05:00, 0, 1, null). at com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextInformationAdded(EODatabaseContext.java:4504) at com.webobjects.eoaccess.EODatabaseContext.performChanges(EODatabaseContext.java:6216) at com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:376) at com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192) at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:1176) at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:1099) at com.hawaiiexecutivetransportation.components.pages.ReservationPaymentPage.processPayment(ReservationPaymentPage.java:155) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1.methodValue(NSKeyValueCoding.java:636) at com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKeyValueCoding.java:1134) at com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueForKey(NSKeyValueCoding.java:1324) at com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1736) at com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCoding.java:447) at com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.valueForKeyPath(NSKeyValueC
odingAdditions.java:212) at com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:1804) at com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java:50) at com.webobjects.appserver._private.WOSubmitButton.invokeAction(WOSubmitButton.java:70) at er.extensions.foundation.ERXPatcher$DynamicElementsPatches$SubmitButton.invokeAction(ERXPatcher.java:203) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105) at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115) at com.webobjects.appserver._private.WOConditional.invokeAction(WOConditional.java:86) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105) at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115) at er.extensions.components._private.ERXWOForm.invokeAction(ERXWOForm.java:218) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105) at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115) at com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComponentContent.java:38) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105) at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115) at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:1079) at er.extensions.components.ERXComponent.invokeAction(ERXComponent.java:168) at com.webobjects.appserver._private.WOComponentReference.invokeAction(WOComponentReference.java:127) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WODynamicGroup.java:105) at com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicGroup.java:115) at com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:1079) at er.extensions.components.ERXComponent.invokeAction(ERXComponent.java:168) at com.webobjects.appserver
.WOSession.invokeAction(WOSession.java:1357) at com.webobjects.appserver.WOApplication.invokeAction(WOApplication.java:1745) at er.extensions.appserver.ajax.ERXAjaxApplication.invokeAction(ERXAjaxApplication.java:117) at er.extensions.appserver.ERXApplication.invokeAction(ERXApplication.java:2029) at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedPage(ERXComponentRequestHandler.java:157) at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedSession(ERXComponentRequestHandler.java:235) at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedApplication(ERXComponentRequestHandler.java:268) at er.extensions.appserver.ERXComponentRequestHandler._handleRequest(ERXComponentRequestHandler.java:302) at er.extensions.appserver.ERXComponentRequestHandler.handleRequest(ERXComponentRequestHandler.java:377) at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1687) at er.extensions.appserver.ERXApplication.dispatchRequestImmediately(ERXApplication.java:2150) at er.extensions.appserver.ERXApplication.dispatchRequest(ERXApplication.java:2115) at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144) at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226) at java.lang.Thread.run(Thread.java:662)
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Feb 20, 2013, at 2:46 PM, Ken Anderson <email@hidden> wrote:
>>>>>>
>>>>>>> Johnny,
>>>>>>>
>>>>>>> Could you post the details of the exception?
>>>>>>>
>>>>>>> Also, how are you getting your primary keys? You really shouldn't have a problem assuming you're using a table for primary keys.
>>>>>>>
>>>>>>> Ken
>>>>>>>
>>>>>>> On Feb 20, 2013, at 5:43 PM, Johnny Miller <email@hidden> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> OK. This is a hard one to explain.
>>>>>>>>
>>>>>>>> Basically, I have a site that has a back and a front end. Separate apps running on the same host. I'm using ERJGroupsSynchronizer. The host is AWS with Amazon Linux AMI. The database is PostgreSQL 9.2.
>>>>>>>>
>>>>>>>> Both ends create objects. For some reason every few days or so I get an EOGeneralAdapterException when the front end goes to insert an object. It's trying to change some properties on an EO of the same type created at the same time in the back end. I'm thinking that is happening because somehow they are sharing the same primary key.
>>>>>>>>
>>>>>>>> If that is right, is there a way to delay the assigning of the key until the object gets inserted?
>>>>>>>>
>>>>>>>> Aloha,
>>>>>>>> Mr. Johnny Miller
>>>>>>>> Web Development Manager
>>>>>>>> Kahalawai Media Company
>>>>>>>> Lahaina, HI 96761
>>>>>>>> tel: (808) 661-7962 | mobile: (808) 283-0791
>>>>>>>> website | e-mail
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> 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
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>> Executive Managing Partner, VP Development and Tecnical Services
>>>
>>> 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!
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>
> --
> Chuck Hill
> Executive Managing Partner, VP Development and Tecnical Services
>
> 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