RE: [WO45] Problem with a new EOQualifier subclass in Java
RE: [WO45] Problem with a new EOQualifier subclass in Java
- Subject: RE: [WO45] Problem with a new EOQualifier subclass in Java
- From: "Labrie, Francis (Liste de distribution)" <email@hidden>
- Date: Wed, 12 Mar 2003 09:04:02 -0500
Hi,
Max Muller wrote:
> Sorry, my 4.5 memory is getting murky. I had to deal
> quite a bit with custom qualifiers in 4.5. What you should
> try is instead of subclassing EOQualifier, subclass
> EOSQLQualifier. This I know works, in fact I have
> attached an IN qualifier from the 4.5 version of
> NetStruxr's open sourced ER frameworks. Hope this helps.
Thanks for your help, it's very appreciated.
I've dropped this class into my framework without change (except the
package) just to test it. Then I've setup a little test case in an existing
application:
EOAttribute attribute;
EODatabaseDataSource databaseDataSource;
EOEditingContext editingContext;
EOEntity entity;
EOFetchSpecification fetchSpecification;
EOQualifier subQueryQualifier, qualifier;
NSArray objects;
entity = EOModelGroup.defaultGroup().entityNamed("Customer");
// Customer "type" is a relationship to a CustomerType entity of
EOEnterpriseObject class
subQueryQualifier = EOQualifier.qualifierWithQualifierFormat("type
= %@", new NSArray(Customer.IndependantType));
qualifier = new ERQualifierInSubquery(entity, subQueryQualifier);
// Single EOFetchSpecification test
fetchSpecification = new EOFetchSpecification("Customer", qualifier,
null);
fetchSpecification.setUsesDistinct(true);
fetchSpecification.setRefreshesRefetchedObjects(true);
eoditingContext = new EOEditingContext();
objects =
eoditingContext.objectsWithFetchSpecification(fetchSpecification);
System.out.println("objects from single EOFetchSpecification = " +
objects);
// WODisplayGroup test
displayGroup = new WODisplayGroup();
databaseDataSource = new EODatabaseDataSource(eoditingContext,
"Customer");
databaseDataSource.setFetchSpecification(fetchSpecification);
displayGroup.setDataSource(databaseDataSource);
displayGroup.qualifyDataSource();
System.out.println("objects from WODisplayGroup = " + objects);
Unfortunately, this test never reach the WODisplayGroup test, it throws an
exception on the
eoditingContext.objectsWithFetchSpecification(fetchSpecification) call:
NSInvalidArgumentException: *** -[NSdoubleNumber length]: selector not
recognized
at
com.genilog.webobjects.eocontrol.ERQualifierInSubquery.sqlStringForSQLExpres
sion(ERQualifierInSubquery.java:81)
at
com.apple.yellow.eocontrol.EOEditingContext.objectsWithFetchSpecification(EO
EditingContext.java:56)
The 81st line of ERQualifierInSubquery to the following code in
sqlStringForSQLExpression(EOSQLExpression) method:
EOSQLExpression expression=EOSQLExpression.
selectStatementForAttributes( _entity.primaryKeyAttributes(),
false,
fs,
_entity);
So what is the problem? Customer primary key is a Microsoft SQL Server
"bigint", a 64 bits number just like the Java long or its associated Long
class. It works well with all Apple EOQualifier.
____________________________________________
Francis Labrie email@hidden
Montreal, Quebec
Canada
_______________________________________________
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.