Re: Weird problem with ERXGenericRecord
Re: Weird problem with ERXGenericRecord
- Subject: Re: Weird problem with ERXGenericRecord
- From: Fabian Peters <email@hidden>
- Date: Sat, 01 Apr 2017 08:18:29 +0200
Hi Markus,
To me it looks like you're getting bitten by the "applyRestrictingQualifierOnInsert" feature:
## Specifies that you want restricting qualifiers "applied" to your newly
## inserted objects. For instance, if you have an entity that is part of
## single table inheritance and your restricting qualifier only uses
## EOAndQualifiers and EOKeyValueQualifiers, ERX can interpret the qualifier
## and make your EO's automatically match the restricting qualifier. This
## allows you to skip the awakeFromInsertion step where you have to remember
## to make your EO match the restricting qualifier you chose in your model.
# er.extensions.ERXEnterpriseObject.applyRestrictingQualifierOnInsert=true
The makeQualifierTrue method in ERXEOControlUtilities is not able to handle your case (and apparently shouldn't). Overriding applyRestrictingQualifierOnInsert() in ElectronicDocument and returning false should do the trickā¦
Fabian
> Am 31.03.2017 um 22:21 schrieb Markus Ruggiero <email@hidden>:
>
> In a large project we have used "extends EOGenericRecord" in our _Entity.java templates.
>
> Just recently we wondered why (probably just an oversight) and changed that to "extends ERXGenericRecord". Don't see any reason why this should not work.
>
> One of our entities (ElectronicDocument) in the eomodel has the following qualifier set in the basic properties in Entity Modeler: (product.visible = 'Y')
> ElectronicDocument has a to-one relationship to Product called product and a Product has a char(1) attribute called visible with possible values 'Y' and 'N'
>
> Or idea is to only ever work with electronic documents that belong to a visible product. This works with EOGenericRecord but does not when using ERXGenericRecord. Using ERXGenericRecord ultimately results in the following crash (dump below). Action was creating a new ElectronicDocument in a D2W app.
>
> Why?????
> It seems that ERXGenericRecord.takeValueForKey() passes its params without anything to EOCustomObject.takeValueForKey() which then crashes. It looks as if the call should go to takeValueForKeyPath() instead or somesuch. Is this a bug in Wonder? What do I miss?
>
> Thanks for any clarification.
>
> ---markus---
>
>
>
> Application: ec_admin
> Error: <com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException message '<com.dsm.ec_admin.eo.ElectronicDocument 0x1be699be> takeValueForKey(): attempt to assign value to unknown key: 'product.visible'. This class does not have an instance variable of the name product.visible or _product.visible, nor a method of the name setProduct.visible or _setProduct.visible' object '<com.dsm.ec_admin.eo.ElectronicDocument pk:"null">' key 'product.visible'>
> Reason: <com.dsm.ec_admin.eo.ElectronicDocument 0x1be699be> takeValueForKey(): attempt to assign value to unknown key: 'product.visible'. This class does not have an instance variable of the name product.visible or _product.visible, nor a method of the name setProduct.visible or _setProduct.visible
> Stack trace:
> File Line# Method Package
> NSKeyValueCoding.java 1399 handleTakeValueForUnboundKey com.webobjects.foundation
> EOCustomObject.java 1562 handleTakeValueForUnboundKey com.webobjects.eocontrol
> NSKeyValueCoding.java 519 handleTakeValueForUnboundKey com.webobjects.foundation
> NSKeyValueCoding.java 899 setValueInObject com.webobjects.foundation
> EOCustomObject.java 1529 takeValueForKey com.webobjects.eocontrol
> ERXGenericRecord.java 1253 takeValueForKey er.extensions.eof
> NSKeyValueCoding.java 469 takeValueForKey com.webobjects.foundation
> ERXEOControlUtilities.java 2190 makeQualifierTrue er.extensions.eof
> ERXGenericRecord.java 513 awakeFromInsertion er.extensions.eof
> EOEditingContext.java 2871 insertObjectWithGlobalID com.webobjects.eocontrol
> ERXEC.java 978 insertObjectWithGlobalID er.extensions.eof
> EOEditingContext.java 2889 insertObject com.webobjects.eocontrol
> ERXEC.java 989 insertObject er.extensions.eof
> ERXEOControlUtilities.java 322 createAndInsertObject er.extensions.eof
> ERXEOControlUtilities.java 297 createAndInsertObject er.extensions.eof
> ERD2WFactory.java 214 _newObjectWithEntity er.directtoweb
> ERD2WFactory.java 225 editPageForNewObjectWithEntityNamed er.directtoweb
> MenuHeader.java 78 newObjectAction com.dsm.ec_admin.components
> NativeMethodAccessorImpl.java NA invoke0 sun.reflect
> NativeMethodAccessorImpl.java 62 invoke sun.reflect
> DelegatingMethodAccessorImpl.java 43 invoke sun.reflect
> Method.java 497 invoke java.lang.reflect
> NSKeyValueCoding.java 636 methodValue com.webobjects.foundation
> NSKeyValueCoding.java 1134 valueInObject com.webobjects.foundation
> NSKeyValueCoding.java 1324 valueForKey com.webobjects.foundation
> WOComponent.java 1736 valueForKey com.webobjects.appserver
> NSKeyValueCoding.java 447 valueForKey com.webobjects.foundation
> NSKeyValueCodingAdditions.java 212 valueForKeyPath com.webobjects.foundation
> WOComponent.java 1804 valueForKeyPath com.webobjects.appserver
> WOKeyValueAssociation.java 50 valueInComponent com.webobjects.appserver._private
> WOImageButton.java 257 invokeAction com.webobjects.appserver._private
> WODynamicGroup.java 105 invokeChildrenAction com.webobjects.appserver._private
> WODynamicGroup.java 115 invokeAction com.webobjects.appserver._private
> ERXWOForm.java 218 invokeAction er.extensions.components._private
> WODynamicGroup.java 105 invokeChildrenAction com.webobjects.appserver._private
> WODynamicGroup.java 115 invokeAction com.webobjects.appserver._private
> WOConditional.java 86 invokeAction com.webobjects.appserver._private
> WODynamicGroup.java 105 invokeChildrenAction com.webobjects.appserver._private
> WODynamicGroup.java 115 invokeAction com.webobjects.appserver._private
> WOComponent.java 1079 invokeAction com.webobjects.appserver
> WOComponentReference.java 127 invokeAction com.webobjects.appserver._private
> WODynamicGroup.java 105 invokeChildrenAction com.webobjects.appserver._private
> WODynamicGroup.java 115 invokeAction com.webobjects.appserver._private
> WOComponent.java 1079 invokeAction com.webobjects.appserver
> WOComponentReference.java 127 invokeAction com.webobjects.appserver._private
> ERXSwitchComponent.java 120 invokeAction er.extensions.components._private
> WOComponent.java 1079 invokeAction com.webobjects.appserver
> ERD2WPage.java 747 invokeAction er.directtoweb.pages
> WOSession.java 1357 invokeAction com.webobjects.appserver
> WOApplication.java 1745 invokeAction com.webobjects.appserver
> ERXAjaxApplication.java 119 invokeAction er.extensions.appserver.ajax
> ERXApplication.java 2006 invokeAction er.extensions.appserver
> ERXComponentRequestHandler.java 157 _dispatchWithPreparedPage er.extensions.appserver
> ERXComponentRequestHandler.java 235 _dispatchWithPreparedSession er.extensions.appserver
> ERXComponentRequestHandler.java 268 _dispatchWithPreparedApplication er.extensions.appserver
> ERXComponentRequestHandler.java 302 _handleRequest er.extensions.appserver
> ERXComponentRequestHandler.java 375 handleRequest er.extensions.appserver
> WOApplication.java 1687 dispatchRequest com.webobjects.appserver
> ERXApplication.java 2127 dispatchRequestImmediately er.extensions.appserver
> ERXApplication.java 2092 dispatchRequest er.extensions.appserver
> WOWorkerThread.java 144 runOnce com.webobjects.appserver._private
> WOWorkerThread.java 226 run com.webobjects.appserver._private
> Thread.java 745 run java.lang
> NA : Non applicable, JIT activated
>
>
> _______________________________________________
> 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