• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Derived Attributes [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Derived Attributes [SOLVED]


  • Subject: Re: Derived Attributes [SOLVED]
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 26 Feb 2010 15:52:31 -0800

Sounds like another of the infamous NSPropertyListSerialization bugs.

NSDictionary.class.isInstance(NSPropertyListSerialization. propertyListFromString("12345")) == true


Chuck

On Feb 26, 2010, at 3:42 PM, Kieran Kelleher wrote:

Surprize, surprize, it turns out that you need some other characters in the expression if you make a derived attribute and the expression is simply another attribute name ..... for example to expose a PK as a readonly "uniqueID" attribute ( don't ask - I don't care about "PKs are a database artifact" theory ;-) ... besides Read-Only is checked on the attr. anyway)

Even a simple SPACE before the expression will make it work... otherwise WO fails to parse the derived expression - sounds like a bug to me - but at least we know the workaround. If you don't like a space, just surround it with brackets ..... like this "(oid)" ... and that works too - great!

http://idisk.me.com/kelleherk/Public/Pictures/Skitch/spaceneeded-20100226-175822.jpg

-Kieran

PS. John, I did try your suggestion of entering columnName = "" in the plist directly first - that was not the solution to this particular problem.

On Feb 26, 2010, at 3:33 PM, John Huss wrote:

My model also has:

     columnName = "";

for my derived attributes - maybe that matters?

John

On Fri, Feb 26, 2010 at 1:51 PM, Kieran Kelleher <email@hidden > wrote:
Hi all,


I tried adding a simple derived attribute to a model, as shown here:

http://idisk.me.com/kelleherk/Public/Pictures/Skitch/derived_attribute-20100226-125124.jpg

However EOF falls over as soon as I touch that entity with an error like the following. This is WO 5.3.3 btw. Looking at the source in EOSQLExpression, it would seem that the attribute_definitionArray is null, because if it is null, then the method tries to get a column name and throws this exception when there is no column name.. The eomodel itself shows the attribute like this in the plist:

        {
            allowsNull = Y;
            definition = oid;
            externalType = INT;
            name = uniqueID;
            valueClassName = NSNumber;
            valueType = i;
        }



So now I put a few statements in didFinishLaunhcing to grab that EOAttribute and check in the debugger and I find that the _definitionArray is empty. That does not seem right, does it?

http://idisk.me.com/kelleherk/Public/Pictures/Skitch/emptydefinitionarray-20100226-131150.jpg

Any ideas why this would not work, or how to troubleshoot it if it should work?

I know Wonder uses programmatically created derived attributes for COUNT(*) and aggregate functions, but is there anyone out there using model-defined derived attributes successfully?

java.lang.IllegalStateException: sqlStringForAttribute: attempt to generate SQL for attribute 'uniqueID' on entity 'CTMessage' with undefined column name. You must define a column name for this attribute before attempting a database operation.
at com .webobjects .eoaccess .EOSQLExpression.sqlStringForAttribute(EOSQLExpression.java:2064)
at com .webobjects .jdbcadaptor .JDBCExpression.addSelectListAttribute(JDBCExpression.java:362)
at com .webobjects .eoaccess .EOSQLExpression .prepareSelectExpressionWithAttributes(EOSQLExpression.java:1006)
at com .webobjects .jdbcadaptor .JDBCExpression .prepareSelectExpressionWithAttributes(JDBCExpression.java:273)
at com .webobjects .eoaccess .EOSQLExpressionFactory .selectStatementForAttributes(EOSQLExpressionFactory.java:226)
at er .extensions .jdbc .ERXSQLHelper.sqlExpressionForFetchSpecification(ERXSQLHelper.java: 635)
at er .extensions .jdbc .ERXSQLHelper.sqlExpressionForFetchSpecification(ERXSQLHelper.java: 569)
at er .extensions .jdbc.ERXSQLHelper.rowCountForFetchSpecification(ERXSQLHelper.java: 1110)
at er .extensions .eof .ERXEOAccessUtilities .rowCountForFetchSpecification(ERXEOAccessUtilities.java:458)
at er .extensions .batching .ERXBatchingDisplayGroup.rowCount(ERXBatchingDisplayGroup.java:292)
at er .extensions .batching .ERXBatchingDisplayGroup.refetch(ERXBatchingDisplayGroup.java:362)
at er .extensions .batching .ERXBatchingDisplayGroup.fetch(ERXBatchingDisplayGroup.java:438)
at wk .eofextensions .WKEOUtils.displayGroupWithFetchSpecification(WKEOUtils.java:1061)
at wk.cheetah.wocomponents.MessagesPage.dg(MessagesPage.java:52)
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:592)
at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor $1.methodValue(NSKeyValueCoding.java:684)
at com.webobjects.foundation.NSKeyValueCoding $_MethodBinding.valueInObject(NSKeyValueCoding.java:1160)
at com.webobjects.foundation.NSKeyValueCoding $DefaultImplementation.valueForKey(NSKeyValueCoding.java:1268)
at com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java: 1539)
at com.webobjects.foundation.NSKeyValueCoding $Utility.valueForKey(NSKeyValueCoding.java:498)
at com.webobjects.foundation.NSKeyValueCodingAdditions $ DefaultImplementation .valueForKeyPath(NSKeyValueCodingAdditions.java:212)
at com .webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java: 1600)
at com .webobjects .appserver ._private .WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java: 46)
at com .webobjects.appserver.WOComponent.valueForBinding(WOComponent.java: 735)
at er .extensions .batching .ERXFlickrBatchNavigation .displayGroup(ERXFlickrBatchNavigation.java:82)
at er .extensions .batching .ERXFlickrBatchNavigation.batchCount(ERXFlickrBatchNavigation.java: 285)
at er .extensions .batching .ERXFlickrBatchNavigation .hasMultiplePages(ERXFlickrBatchNavigation.java:94)
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:592)
at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor $1.methodValue(NSKeyValueCoding.java:684)
at com.webobjects.foundation.NSKeyValueCoding $_MethodBinding.valueInObject(NSKeyValueCoding.java:1160)
at com.webobjects.foundation.NSKeyValueCoding $DefaultImplementation.valueForKey(NSKeyValueCoding.java:1268)
at com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java: 1539)
at com.webobjects.foundation.NSKeyValueCoding $Utility.valueForKey(NSKeyValueCoding.java:498)
at com.webobjects.foundation.NSKeyValueCodingAdditions $ DefaultImplementation .valueForKeyPath(NSKeyValueCodingAdditions.java:212)
at com .webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java: 1600)
at com .webobjects .appserver ._private .WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java: 46)
at com .webobjects .appserver.WOAssociation.booleanValueInComponent(WOAssociation.java: 278)
at er .extensions .components .conditionals .ERXWOConditional.conditionInComponent(ERXWOConditional.java:47)
at er .extensions .components .conditionals .ERXWOConditional.meetsConditionInComponent(ERXWOConditional.java:52)
at er .extensions .components .conditionals .ERXWOConditional.appendToResponse(ERXWOConditional.java:120)
at com .webobjects .appserver ._private .WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:121)
at com .webobjects .appserver ._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:130)
at com .webobjects.appserver.WOComponent.appendToResponse(WOComponent.java: 992)
at er .extensions .components.ERXComponent.appendToResponse(ERXComponent.java:107)
at com .webobjects .appserver ._private .WOComponentReference.appendToResponse(WOComponentReference.java:111)
at com .webobjects .appserver ._private .WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:121)
at com .webobjects .appserver ._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:130)
at com .webobjects .appserver ._private .WOComponentContent.appendToResponse(WOComponentContent.java:43)
at com .webobjects .appserver ._private .WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:121)
at com .webobjects .appserver ._private .WOGenericContainer.appendToResponse(WOGenericContainer.java:32)
at com .webobjects .appserver ._private .WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:121)
at com .webobjects .appserver ._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:130)
at com .webobjects.appserver.WOComponent.appendToResponse(WOComponent.java: 992)
at er .extensions .components.ERXComponent.appendToResponse(ERXComponent.java:107)
at wk .webobjects .appserver .WKAbstractComponent.appendToResponse(WKAbstractComponent.java:487)
at wk .cheetah.wocomponents.PageWrapper.appendToResponse(PageWrapper.java: 247)
at com .webobjects .appserver ._private .WOComponentReference.appendToResponse(WOComponentReference.java:111)
at com .webobjects .appserver ._private .WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:121)
at com .webobjects .appserver ._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:130)
at com .webobjects.appserver.WOComponent.appendToResponse(WOComponent.java: 992)
at er .extensions .components.ERXComponent.appendToResponse(ERXComponent.java:107)
at wk .webobjects .appserver .WKAbstractComponent.appendToResponse(WKAbstractComponent.java:487)
at com.webobjects.appserver.WOSession.appendToResponse(WOSession.java: 1200)
at er.extensions.appserver.ERXSession.appendToResponse(ERXSession.java: 540)
at wk.webobjects.appserver.WKSession.appendToResponse(WKSession.java: 211)
at wk.cheetah.Session.appendToResponse(Session.java:442)
at com .webobjects .appserver.WOApplication.appendToResponse(WOApplication.java:1418)
at er .extensions .appserver.ERXApplication.appendToResponse(ERXApplication.java:1817)
at com .webobjects .appserver ._private .WOComponentRequestHandler ._dispatchWithPreparedPage(WOComponentRequestHandler.java:230)
at com .webobjects .appserver ._private .WOComponentRequestHandler ._dispatchWithPreparedSession(WOComponentRequestHandler.java:287)
at com .webobjects .appserver ._private .WOComponentRequestHandler ._dispatchWithPreparedApplication(WOComponentRequestHandler.java:322)
at com .webobjects .appserver ._private .WOComponentRequestHandler ._handleRequest(WOComponentRequestHandler.java:358)
at com .webobjects .appserver ._private .WOComponentRequestHandler .handleRequest(WOComponentRequestHandler.java:435)
at com .webobjects .appserver.WOApplication.dispatchRequest(WOApplication.java:1306)
at er .extensions .appserver .ERXApplication.dispatchRequestImmediately(ERXApplication.java:1915)
at er .extensions .appserver.ERXApplication.dispatchRequest(ERXApplication.java:1880)
at wk .webobjects .appserver.WKApplication.dispatchRequest(WKApplication.java:276)
at com .webobjects .appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:173)
at com .webobjects .appserver._private.WOWorkerThread.run(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:613)

_______________________________________________ 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/products/practical_webobjects








_______________________________________________
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


References: 
 >Derived Attributes (From: Kieran Kelleher <email@hidden>)
 >Re: Derived Attributes [SOLVED] (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: Derived Attributes [SOLVED]
  • Next by Date: Re: Installing WO on Centos 5.4
  • Previous by thread: Re: Derived Attributes [SOLVED]
  • Next by thread: Javascript Question
  • Index(es):
    • Date
    • Thread