From: Dominique S. <dom...@ci...> - 2006-07-24 19:51:36
|
You needs to subclass ERXDatabaseContextDelegate like this: public void databaseContextDidSelectObjects(EODatabaseContext dc, EOFetchSpecification fs, EODatabaseChannel channel) { if (fs.entityName().equals("....")) // or whatever condition you may need channel._isFetchingSingleTableEntity = true; } The goal is to access the _isFetchingSingleTableEntity flag of the EODatabaseChannel in order to put it to true in order that EOF take care of the EOEntity subclasses and create the objects of the right subclass !! I give more explanation in a post in the EOF omnigroup news group. Note: To access the isFetchingSingleTableEntity which is protected, the EODatabaseContext delegate needs to be a in the com.webobjects.eoaccess package... On 22 juil. 06, at 14:57, Marc Gumpinger wrote: > Hi, > > when I use ERXEOControlUtilities.objectsInRange with a fetch spec > that fetches an abstract enterprise object, I get the following > exception. > However, when using the very same fetch spec on the editing > context's good old objectsWithFetchSpecification, everything works > fine. > > Does ERXEOControlUtilities.objectsInRange not work with abstract > EOs or am I doing anything wrong here? > > > Regards > Marc > > > > [2006-07-22 14:48:36 CEST] <main> A fatal exception occurred: null: > <net.gumpinger.vilfredo.eos.AbstractAnswer> is an abstract class. > It can not be instantiated ! > [2006-07-22 14:48:36 CEST] <main> > com.webobjects.foundation.NSForwardException for > java.lang.InstantiationException > at > sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance( > InstantiationExceptionConstructorAccessorImpl.java:30) > at java.lang.reflect.Constructor.newInstance(Constructor.java:274) > at > com.webobjects.foundation._NSUtilities.instantiateObjectWithConstructo > r(_NSUtilities.java:594) > at > com.webobjects.eoaccess.EOEntityClassDescription.createInstanceWithEdi > tingContext(EOEntityClassDescription.java:207) > at com.webobjects.eoaccess.EODatabaseChannel._fetchObject > (EODatabaseChannel.java:417) > at > com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificati > onEditingContext(EODatabaseContext.java:3222) > at > com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecificatio > n(EODatabaseContext.java:3347) > at > com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpec > ification(EOObjectStoreCoordinator.java:539) > at > com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecificatio > n(EOEditingContext.java:4075) > at > com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecificatio > n(EOEditingContext.java:4461) > at er.extensions.ERXEOControlUtilities.objectsInRange > (ERXEOControlUtilities.java:438) > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys -- and earn > cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV________________________________ > _______________ > Wonder-disc mailing list > Won...@li... > https://lists.sourceforge.net/lists/listinfo/wonder-disc |