Re: EOAndQualifier on child entity property
Re: EOAndQualifier on child entity property
- Subject: Re: EOAndQualifier on child entity property
- From: Yann Bizeul <email@hidden>
- Date: Fri, 18 Aug 2006 21:29:15 +0200
A safer bet is to use some extensions to WO. See Pierre Bernards
excellent qualifier extensions at
http://www.bernard-web.com/pierre/webobjects/code.html
I tried that with the following code :
public Main doFind()
{
Main nextPage = (Main)pageWithName("Main");
NSArray tags = NSArray.componentsSeparatedByString(tag," ");
NSMutableArray tagsQualifiers = new NSMutableArray();
int i;
for (i=0;i<tags.count();i++)
{
EOQualifier q = EOQualifier.qualifierWithQualifierFormat("tag = %
@",new NSArray(tags.objectAtIndex(i)));
tagsQualifiers.addObject(new ExistsInRelationshipQualifier("tags",q));
}
EOAndQualifier tagsQualifier = new EOAndQualifier(tagsQualifiers);
EOFetchSpecification f = new EOFetchSpecification
("Location",tagsQualifier,null);
nextPage.searchResults = session().defaultEditingContext
().objectsWithFetchSpecification(f);
return nextPage;
}
All I get is the following exception :
[2006-08-18 21:25:15 CEST] <WorkerThread0>
java.lang.NullPointerException
at com.webobjects.eoaccess.EOSQLExpression._aliasForRelationshipPath
(EOSQLExpression.java:324)
at
com.webobjects.eoaccess.EOSQLExpression._aliasForRelatedAttributeRelatio
nshipPath(EOSQLExpression.java:259)
at
com.houdah.webobjects.eoaccess.qualifiers.ExistsInRelationshipQualifierS
upport.sqlStringForSQLExpression
(ExistsInRelationshipQualifierSupport.java:100)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$Support._sqlStringForSQLExpression(EOQualifierSQLGeneration.java:151)
at
com.webobjects.eoaccess.EOSQLExpression.sqlStringForArrayOfQualifiers
(EOSQLExpression.java:1562)
at
com.webobjects.eoaccess.EOSQLExpression.sqlStringForConjoinedQualifiers(
EOSQLExpression.java:1597)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$_AndQualifierSupport.sqlStringForSQLExpression
(EOQualifierSQLGeneration.java:512)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$Support._sqlStringForSQLExpression(EOQualifierSQLGeneration.java:151)
at
com.webobjects.eoaccess.EOSQLExpression.sqlStringForArrayOfQualifiers
(EOSQLExpression.java:1562)
at
com.webobjects.eoaccess.EOSQLExpression.sqlStringForConjoinedQualifiers(
EOSQLExpression.java:1597)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$_AndQualifierSupport.sqlStringForSQLExpression
(EOQualifierSQLGeneration.java:512)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$Support._sqlStringForSQLExpression(EOQualifierSQLGeneration.java:151)
at
com.webobjects.eoaccess.EOSQLExpression.prepareSelectExpressionWithAttri
butes(EOSQLExpression.java:1024)
at
com.webobjects.jdbcadaptor.JDBCExpression.prepareSelectExpressionWithAtt
ributes(JDBCExpression.java:273)
at
com.webobjects.eoaccess.EOSQLExpressionFactory.selectStatementForAttribu
tes(EOSQLExpressionFactory.java:226)
at com.webobjects.jdbcadaptor.JDBCChannel.selectAttributes
(JDBCChannel.java:178)
at
com.webobjects.eoaccess.EODatabaseChannel._selectWithFetchSpecificationE
ditingContext(EODatabaseChannel.java:878)
at
com.webobjects.eoaccess.EODatabaseChannel.selectObjectsWithFetchSpecific
ation(EODatabaseChannel.java:215)
at
com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecification
EditingContext(EODatabaseContext.java:3205)
at
com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(
EODatabaseContext.java:3346)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecif
ication(EOObjectStoreCoordinator.java:539)
at
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(
EOEditingContext.java:4114)
at
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(
EOEditingContext.java:4500)
at FindRightComponent.doFind(FindRightComponent.java:36)
Yann Bizeul • yann at tynsoe.org
Cocoa Developer
_______________________________________________
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