Re: ExistsInRelationshipQualifier
Re: ExistsInRelationshipQualifier
- Subject: Re: ExistsInRelationshipQualifier
- From: Chuck Hill <email@hidden>
- Date: Mon, 19 May 2008 18:06:44 -0700
Start my turning on SQL logging and seeing what SQL is generated.
Chuck
On May 19, 2008, at 5:42 PM, James Cicenia wrote:
OK -
I replaced it this time and sure enough I don't get a npe. However,
I am also not seeing any filtering.
The qualifier indeed ends with:
and (not (documents CONTAINS at least 1 elements))
How do I debug this?
-j-
On May 19, 2008, at 7:03 PM, Chuck Hill wrote:
The second was the same too? Are you sure? I just fixed that late
last week...
On May 19, 2008, at 4:38 PM, James Cicenia wrote:
OK -
My code is the same so no changes were made.
My usage:
byPortfolioQualifier = new EOAndQualifier(new NSArray(new Object[]
{byPortfolioQualifier, hasDocumentsQualifier()}));
public EOQualifier hasDocumentsQualifier(){
ExistsInRelationshipQualifier qual = new
ExistsInRelationshipQualifier("documents",null);
EONotQualifier not = new EONotQualifier(qual);
return not;
}
HTH
-j-
On May 19, 2008, at 6:19 PM, Chuck Hill wrote:
On May 19, 2008, at 3:30 PM, James Cicenia wrote:
Did this ever work for you?
Yes, frequently.
I have just started using this query and am getting:
[2008-05-19 17:17:07 CDT] <WorkerThread1>
java.lang.NullPointerException
at
com
.webobjects
.eoaccess
.EOSQLExpression._aliasForRelationshipPath(EOSQLExpression.java:
324)
at
com
.webobjects
.eoaccess
.EOSQLExpression
._aliasForRelatedAttributeRelationshipPath(EOSQLExpression.java:
259)
at
com
.houdah
.webobjects
.eoaccess
.qualifiers
.ExistsInRelationshipQualifierSupport
.sqlStringForSQLExpression
(ExistsInRelationshipQualifierSupport.java:100)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$
Support._sqlStringForSQLExpression(EOQualifierSQLGeneration.java:
151)
Bonus points if you actually provide the code for _how_ your are
using it...
And, I updated the qualifier from the posted link to the java
file ExistsInRelationshipQualifierSupport
There have been some bugs in this for certain usage patterns.
Pierre and I were looking at it just last week. Can you try this
(one at a time, please), and let us know the results.
1. Edit
ExistsInRelationshipQualifierSupport.sqlStringForSQLExpression(),
find the bit of code like the below, and edit it to look like
this (if it does not already):
if (joinCount > 0) {
for (int j = 0; j < joinCount; j++) {
EOJoin join = (EOJoin) joins.objectAtIndex(j);
EOAttribute sourceAttribute = join.sourceAttribute();
EOAttribute destinationAttribute = join.destinationAttribute();
subBuffer.append(" AND ");
subBuffer
.append(expression._aliasForRelatedAttributeRelationshipPath(
sourceAttribute,
Qualifier.allButLastPathComponent(keyPath)));
subBuffer.append(" = ");
subBuffer
.append(subExpression._aliasForRelatedAttributeRelationshipPath(
destinationAttribute, ""));
}
}
2. Edit Qualifier.allButLastPathComponent() to be like this:
public static String allButLastPathComponent(String path)
{
int i = path.lastIndexOf(KEY_PATH_SEPARATOR_CHAR);
return (i < 0) ? "" : path.substring(0, i);
}
Did either of those fix things for you?
Chuck
On Dec 5, 2007, at 1: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
_______________________________________________
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
--
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
--
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
--
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