Re: Fetching from related object
Re: Fetching from related object
- Subject: Re: Fetching from related object
- From: Randall Perry <email@hidden>
- Date: Sun, 25 Apr 2004 14:26:05 -0400
on 4/23/04 9:15 PM, Art Isbell at email@hidden wrote:
> On Apr 23, 2004, at 12:54 PM, Randall Perry wrote:
>
>> qual = EOQualifier.qualifierWithQualifierFormat("custNo = '" +
>> custInfo.custNo() + "' and dateTime > '" + dateOneYearAgo, null);
>
>> There is a to-one relationship defined in EOModeler between the Log and
>> CustView entities.
>
> You might run into trouble embedding dates in the qualifying format
> string. It's usually preferable to take advantage of EOF's ability to
> property format "where" clauses (and easier to read as well). Assuming
> the to-one relationship is Log.custView:
>
> qual = EOQualifier.qualifierWithQualifierFormat("custView = %@ and
> dateTime > %@", new NSArray(new Object[] {custInfo, dateOneYearAgo}));
>
Tried the fetch as you suggested:
qual = EOQualifier.qualifierWithQualifierFormat("CustView = %@ and dateTime
> %@", new NSArray(new Object[] {custInfo, dateOneYearAgo}));
EOFetchSpecification logFetchSpec = new EOFetchSpecification("Log", qual,
null);
logInfo = ec.objectsWithFetchSpecification(logFetchSpec);
But it threw a ClassCastException at runtime:
Application:
TASUpload
Error:
java.lang.ClassCastException
Reason:
Stack trace:
File
Line#
Method
Package
EOQualifierSQLGeneration.java
417
schemaBasedQualifierWithRootEntity
com.webobjects.eoaccess
EOQualifierSQLGeneration.java
165
_schemaBasedQualifierWithRootEntity
com.webobjects.eoaccess
EOQualifierSQLGeneration.java
502
schemaBasedQualifierWithRootEntity
com.webobjects.eoaccess
EOQualifierSQLGeneration.java
165
_schemaBasedQualifierWithRootEntity
com.webobjects.eoaccess
EODatabaseChannel.java
210
selectObjectsWithFetchSpecification
com.webobjects.eoaccess
EODatabaseContext.java
3196
_objectsWithFetchSpecificationEditingContext
com.webobjects.eoaccess
EODatabaseContext.java
3337
objectsWithFetchSpecification
com.webobjects.eoaccess
EOObjectStoreCoordinator.java
539
objectsWithFetchSpecification
com.webobjects.eocontrol
EOEditingContext.java
4053
objectsWithFetchSpecification
com.webobjects.eocontrol
EOEditingContext.java
4438
objectsWithFetchSpecification
com.webobjects.eocontrol
DirectAction.java
52
loginAction
DirectAction
--
Randall Perry
sysTame
Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales
http://www.systame.com/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.