Re: ExistsInRelationshipQualifier
Re: ExistsInRelationshipQualifier
- Subject: Re: ExistsInRelationshipQualifier
- From: Pierre Bernard <email@hidden>
- Date: Thu, 6 Dec 2007 00:30:20 +0100
The fix has been committed to http://houdah-webobjects-frameworks.googlecode.com/svn/trunk/HoudahEOAccess/src/com/houdah/eoaccess/qualifiers/ExistsInRelationshipQualifierSupport.java
Pierre
On Dec 5, 2007, at 11:39 PM, David Holt wrote:
Dear Pierre,
I had the entire eocontrol framework added to my project. Weird! I
cleaned and rebuilt the project and....
now it works!! Thanks so much!! This is such a helpful qualifier to
me!!
Did you want me to post something back to the list about this
problem's resolution? Or will you put the fix in the Houdah framework?
That was really useful. Thanks again,
David
On 5-Dec-07, at 2:33 PM, Pierre Bernard wrote:
David,
You have a compilation error. You lack
AbstractKeyValueCodingProtectedAccessor from the
HoudahFoundationFramework.
You could either drop KeyValueCodingProtectedAccessor from the
com.houdah.eocontrol.qualifiers package or go grab
AbstractKeyValueCodingProtectedAccessor.
Pierre
On Dec 5, 2007, at 11:13 PM, David Holt wrote:
This is quite the detective work!! Thanks so much for helping me
out with this. Your fix got me further, but then the following
happened:
java.lang.Error: Unresolved compilation problems:
The method accessor(Field) is undefined for the type
KeyValueCodingProtectedAccessor
Incompatible operand types NSKeyValueCoding.ValueAccessor and
KeyValueCodingProtectedAccessor
at
com
.houdah
.eocontrol
.qualifiers
.KeyValueCodingProtectedAccessor
.setFieldValue(KeyValueCodingProtectedAccessor.java:70)
at com.webobjects.foundation.NSKeyValueCoding
$_FieldBinding._setValidatedValueInObject(NSKeyValueCoding.java:
1044)
at com.webobjects.foundation.NSKeyValueCoding
$_FieldBinding.setValueInObject(NSKeyValueCoding.java:1052)
at com.webobjects.foundation.NSKeyValueCoding
$DefaultImplementation.takeValueForKey(NSKeyValueCoding.java:1293)
at com.webobjects.foundation.NSKeyValueCoding
$Utility.takeValueForKey(NSKeyValueCoding.java:521)
at
com
.houdah
.eocontrol
.qualifiers
.ExistsInRelationshipQualifier
.clone(ExistsInRelationshipQualifier.java:288)
at
com
.houdah
.eoaccess
.qualifiers
.ExistsInRelationshipQualifierSupport
.schemaBasedQualifierWithRootEntity
(ExistsInRelationshipQualifierSupport.java:218)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
Support
._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:
165)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
_NotQualifierSupport
.schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:
564)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
Support
._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:
165)
at
er
.extensions
.ERXSQLHelper.sqlExpressionForFetchSpecification(ERXSQLHelper.java:
449)
at
er
.extensions
.ERXSQLHelper.rowCountForFetchSpecification(ERXSQLHelper.java:513)
at
er
.extensions
.ERXEOAccessUtilities
.rowCountForFetchSpecification(ERXEOAccessUtilities.java:284)
at
er
.extensions
.ERXBatchingDisplayGroup.rowCount(ERXBatchingDisplayGroup.java:189)
at
er
.extensions
.ERXBatchingDisplayGroup.refetch(ERXBatchingDisplayGroup.java:216)
at
er
.extensions
.ERXBatchingDisplayGroup.fetch(ERXBatchingDisplayGroup.java:276)
at
TryNewStuffDisplayGroup
.artifactDisplayGroup(TryNewStuffDisplayGroup.java:60)
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:585)
at
KeyValueCodingProtectedAccessor
.methodValue(KeyValueCodingProtectedAccessor.java:54)
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:216)
at
com
.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:
1600)
at
com
.webobjects
.appserver
._private
.WOKeyValueAssociation.valueInComponent(WOKeyValueAssociation.java:
46)
at
er
.extensions
.ERXWOTextField
._appendValueAttributeToResponse(ERXWOTextField.java:125)
at
com
.webobjects
.appserver
._private.WOInput.appendAttributesToResponse(WOInput.java:140)
at
com
.webobjects
.appserver
._private
.WOHTMLDynamicElement
._appendOpenTagToResponse(WOHTMLDynamicElement.java:395)
at
com
.webobjects
.appserver
._private
.WOHTMLDynamicElement.appendToResponse(WOHTMLDynamicElement.java:
420)
at
er.extensions.ERXWOTextField.appendToResponse(ERXWOTextField.java:
184)
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
er
.extensions
.ERXWOConditional.appendChildrenToResponse(ERXWOConditional.java:
115)
at
er
.extensions
.ERXWOConditional.appendToResponse(ERXWOConditional.java:109)
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
com
.webobjects
.appserver
._private
.WOComponentReference.appendToResponse(WOComponentReference.java:
111)
at
com
.webobjects
.appserver
._private
.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:121)
at
er.extensions.ERXWOForm.appendChildrenToResponse(ERXWOForm.java:218)
at er.extensions.ERXWOForm.appendToResponse(ERXWOForm.java:342)
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
com.webobjects.appserver.WOSession.appendToResponse(WOSession.java:
1200)
at er.extensions.ERXSession.appendToResponse(ERXSession.java:529)
at
com
.webobjects
.appserver.WOApplication.appendToResponse(WOApplication.java:1418)
at
er.extensions.ERXApplication.appendToResponse(ERXApplication.java:
1120)
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:432)
at
com
.webobjects
.appserver.WOApplication.dispatchRequest(WOApplication.java:1306)
at
er.extensions.ERXApplication.dispatchRequest(ERXApplication.java:
1184)
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)
On 5-Dec-07, at 2:07 PM, Pierre Bernard wrote:
Hi David!
You are quite unlucky. When I developed the qualifiers, I worked
on a project which had no compound joins and hardly any flattened
relationships. So these things were not tested. Actually I forgot
implementing support in some spot.
Your original stacktrace was for a NullPointerException. Now you
have a StringIndexOutOfBoundsException. So there has been some
change as the result of upgrading to a newer version of the code.
As it happens, the crash is now in a fix I implemented a couple
of month ago for Chuck Hill.
I currently have no project or model on which to test things.
Could you please try replacing line 163 in
ExistsInRelationshipQualifierSupport with the following:
String prefix = (relationshipIndex > 0) ?
keyPath.substring(0, relationshipIndex - 1) : "";
This should get you past the crash. With a little luck it will
work all the way through. But as I said: compound and flattened
relationships were only tested on the field. No idea how large
"the field" is. I don't know how many people use the qualifiers
or in which setups they are used.
Pierre
On Dec 5, 2007, at 9:29 PM, David Holt wrote:
Hi Pierre,
If you don't mind, I'd like to keep my complete stack traces off-
list. Below I have copied the error that I get using the Houdah
frameworks downloaded today.
The code is a simple many to many join with a join table with a
compound foreign key that consists of the primary keys of the
ApplicationUser and Artifact tables. The relationships are
flattened both ways.
The code is:
public EOFetchSpecification getPubliclyDisplayed() {
EOQualifier q1 = new EOKeyValueQualifier( "userName",
EOQualifier.QualifierOperatorEqual,
applicationUser.userName());
ExistsInRelationshipQualifier q2 = new
ExistsInRelationshipQualifier("applicationUsers", q1);
// the inverse
EONotQualifier notq2 = new EONotQualifier(q2);
// EOQualifier q3 = new EOAndQualifier( new NSArray( new
Object[] { q1, notq2 } ) );
EOFetchSpecification fs = new
EOFetchSpecification( "Artifact", notq2, null );
return fs;
}
51359 [WorkerThread4] WARN NSLog -
<com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
java.lang.StringIndexOutOfBoundsException: String index out of
range: -1
[2007-12-05 12:15:34 PST] <WorkerThread4>
java.lang.StringIndexOutOfBoundsException: String index out of
range: -1
at java.lang.String.substring(String.java:1768)
at
com
.houdah
.eoaccess
.qualifiers
.ExistsInRelationshipQualifierSupport
.schemaBasedQualifierWithRootEntity
(ExistsInRelationshipQualifierSupport.java:163)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
Support
._schemaBasedQualifierWithRootEntity
(EOQualifierSQLGeneration.java:165)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
_NotQualifierSupport
.schemaBasedQualifierWithRootEntity
(EOQualifierSQLGeneration.java:564)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
Support
._schemaBasedQualifierWithRootEntity
(EOQualifierSQLGeneration.java:165)
at
er
.extensions
.ERXSQLHelper
.sqlExpressionForFetchSpecification(ERXSQLHelper.java:449)
at
er
.extensions
.ERXSQLHelper.rowCountForFetchSpecification(ERXSQLHelper.java:513)
at
er
.extensions
.ERXEOAccessUtilities
.rowCountForFetchSpecification(ERXEOAccessUtilities.java:284)
at
er
.extensions
.ERXBatchingDisplayGroup.rowCount(ERXBatchingDisplayGroup.java:
189)
at
er
.extensions
.ERXBatchingDisplayGroup.refetch(ERXBatchingDisplayGroup.java:216)
at
er
.extensions
.ERXBatchingDisplayGroup.fetch(ERXBatchingDisplayGroup.java:276)
at
TryNewStuffDisplayGroup
.artifactDisplayGroup(TryNewStuffDisplayGroup.java:60)
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:585)
at
KeyValueCodingProtectedAccessor
.methodValue(KeyValueCodingProtectedAccessor.java:54)
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:216)
at
com
.webobjects
.appserver.WOComponent.valueForKeyPath(WOComponent.java:1600)
at
com
.webobjects
.appserver
._private
.WOKeyValueAssociation
.valueInComponent(WOKeyValueAssociation.java:46)
at
er
.extensions
.ERXWOTextField
._appendValueAttributeToResponse(ERXWOTextField.java:125)
at
com
.webobjects
.appserver
._private.WOInput.appendAttributesToResponse(WOInput.java:140)
at
com
.webobjects
.appserver
._private
.WOHTMLDynamicElement
._appendOpenTagToResponse(WOHTMLDynamicElement.java:395)
at
com
.webobjects
.appserver
._private
.WOHTMLDynamicElement.appendToResponse(WOHTMLDynamicElement.java:
420)
at
er
.extensions.ERXWOTextField.appendToResponse(ERXWOTextField.java:
184)
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
er
.extensions
.ERXWOConditional.appendChildrenToResponse(ERXWOConditional.java:
115)
at
er
.extensions
.ERXWOConditional.appendToResponse(ERXWOConditional.java:109)
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
com
.webobjects
.appserver
._private
.WOComponentReference.appendToResponse(WOComponentReference.java:
111)
at
com
.webobjects
.appserver
._private
.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:121)
at
er.extensions.ERXWOForm.appendChildrenToResponse(ERXWOForm.java:
218)
at er.extensions.ERXWOForm.appendToResponse(ERXWOForm.java:342)
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
com
.webobjects.appserver.WOSession.appendToResponse(WOSession.java:
1200)
at er.extensions.ERXSession.appendToResponse(ERXSession.java:529)
at
com
.webobjects
.appserver.WOApplication.appendToResponse(WOApplication.java:1418)
at
er
.extensions.ERXApplication.appendToResponse(ERXApplication.java:
1120)
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:432)
at
com
.webobjects
.appserver.WOApplication.dispatchRequest(WOApplication.java:1306)
at
er.extensions.ERXApplication.dispatchRequest(ERXApplication.java:
1184)
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)
On 5-Dec-07, at 11:41 AM, Pierre Bernard wrote:
Hi David!
You don't need to grab all of the frameworks if all you want is
the qualifiers. The frameworks are geared to be a D2W
replacement with lots of extra goodies at the lower levels.
Currently the whole thing lacks a sample application to show
off how to use the frameworks as a whole. I will gladly assist
anyone who wants to create an application build upon Houdah
Frameworks. I however don't think that's what you are after
right now.
Feel free to just grab the bits of code you really need. I.e.
the ones that were in the tar file on my site.
You could also elect to take stuff up to the layer you need.
That should be Foundation, EOControl and EOAccess. That would
be the easiest thing to do as you will have the principal
classes set up as needed.
The frameworks were built against WO 5.2. There shouldn't be
any problems using them with WO 5.3. I didn't yet bother trying
5.4. I am currently roaming in Cocoa-land.
I know that recent versions of WOLips balk at my WOComponents
because I rely on handleUnboundKey. If you want the components,
turn those warnings off. Everything is just fine.
Best,
Pierre Bernard
Houdah Software s.à r.l.
On Dec 5, 2007, at 8:25 PM, David Holt wrote:
Hi Pierre,
Thanks for the reply. I was using the QualifierAdditions
available at your blog, so I am sure that the line numbers
don't match with Daniele's. Chuck sent me an updated version
of that framework last night which didn't work and gives
different line numbers than the error I reported yesterday.
I will switch to the Houdah frameworks before I make a
detailed report of the error. I have imported the projects
into Eclipse from the Google SVN repository but there are a
ton of errors showing up in Eclipse. Is that the correct
procedure? Can you tell me which projects I need to install as
frameworks to import into my project? Once I get that up and
running, I'll report back. Thanks!
David
On 5-Dec-07, at 9:27 AM, Pierre Bernard wrote:
Hi David!
Seems like you are experiencing the same crash as Daniele.
Unfortunately the line numbers in the stack trace don't much
with what I have in the Google Code repository.
Your stack trace shows a call to
_aliasForRelatedAttributeRelationshipPath at line 99 of
ExistsInRelationshipQualifierSupport. I find 2 such calls.
One at line 119 and one at 123. Which one is it?
How come the lines don't match?
What do the joins between the tables look like? Single or
compound foreign keys? Any flattened relationships?
Could you tell me what expression, subExpression,
sourceAttribute and destinationAttribute look like at the
moment of the crash?
Pierre
On Dec 5, 2007, at 2:51 AM, David Holt wrote:
Hello All,
I am finally getting the chance to use the
QualifierAdditions from Pierre Bernard (thanks Pierre!). I
am using the following code that generates a
NullPointerException. Can anyone see what I have done wrong?
I am trying to show all Artifacts that have not been
specified as "favourites".
public EOFetchSpecification getPubliclyDisplayed() {
EOQualifier q1 = new EOKeyValueQualifier( "userName",
EOQualifier.QualifierOperatorEqual,
applicationUser.userName());
ExistsInRelationshipQualifier q2 = new
ExistsInRelationshipQualifier("applicationUsers", q1);
// the inverse
EONotQualifier notq2 = new EONotQualifier(q2);
// EOQualifier q3 = new EOAndQualifier( new NSArray( new
Object[] { q1, notq2 } ) );
EOFetchSpecification fs = new
EOFetchSpecification( "Artifact", notq2, null );
return fs;
}
Stack trace:
java.lang.NullPointerException
File
Line#
Method
Package
EOSQLExpression.java
324
_aliasForRelationshipPath
com.webobjects.eoaccess
EOSQLExpression.java
259
_aliasForRelatedAttributeRelationshipPath
com.webobjects.eoaccess
ExistsInRelationshipQualifierSupport.java
99
sqlStringForSQLExpression
com.houdah.webobjects.eoaccess.qualifiers
EOQualifierSQLGeneration.java
151
_sqlStringForSQLExpression
com.webobjects.eoaccess
EOSQLExpression.java
1024
prepareSelectExpressionWithAttributes
com.webobjects.eoaccess
JDBCExpression.java
273
prepareSelectExpressionWithAttributes
com.webobjects.jdbcadaptor
EOSQLExpressionFactory.java
226
selectStatementForAttributes
com.webobjects.eoaccess
ERXSQLHelper.java
461
sqlExpressionForFetchSpecification
er.extensions
ERXSQLHelper.java
513
rowCountForFetchSpecification
er.extensions
ERXEOAccessUtilities.java
284
rowCountForFetchSpecification
er.extensions
ERXBatchingDisplayGroup.java
189
rowCount
er.extensions
ERXBatchingDisplayGroup.java
216
refetch
er.extensions
ERXBatchingDisplayGroup.java
276
fetch
_______________________________________________
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
- - -
Houdah Software s. à r. l.
http://www.houdah.com
HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend
- - -
Houdah Software s. à r. l.
http://www.houdah.com
HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend
- - -
Houdah Software s. à r. l.
http://www.houdah.com
HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend
- - -
Houdah Software s. à r. l.
http://www.houdah.com
HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend
- - -
Houdah Software s. à r. l.
http://www.houdah.com
HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend
_______________________________________________
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