Salut Samuel! Good catch, that looks like it might work! Merci bien!
Fabian > Am 12.02.2019 um 14:50 schrieb Samuel Pelletier <sam...@samkar.com>: > > Hi Fabian, > > I'm not familiar with this low level part of EOF but after surfing the doc I > may have something. > > Have you try to register the CooperatingObjectStoreWasAddedNotification ? If > the new object store is passed, you may have an opportunity to force load the > model there. > > Regards, > > Samuel > > >> Le 12 févr. 2019 à 07:16, Fabian Peters <lists.fab...@e-lumo.com> a écrit : >> >> Hello everybody! >> >> I've come across an issue with cross-model inheritance (single-table in this >> case). For a minimal test setup I added an EOModel FrameworkUser to >> ERMoviesLogic, containing an abstract parent entity AbstractUser and a >> concrete child entity FrameworkUser. I added a second EOModel AppUser with a >> concrete child of AbstractUser called AppUser to the ERModernMoviesTest app. >> >> Fetching for all AbstractUser EOs does return all concrete child EOs, i.e. >> both FrameworkUser and AppUser. Accessing attributes that are available on >> AbstractUser is fine, but deleting an AppUser EO causes an exception: >> >> java.lang.IllegalStateException: Unable to find entity for object >> >> It turns out that the EOModel AppUser is not being added to the EODatabase >> when the fetch is carried out. >> >> Deletion with concrete child entity in FrameworkUser: >> >> ERXDatabase.addModel: FrameworkUser >> Feb 12 12:09:07 ERModernMoviesTest[9876] DEBUG NSLog - Using JDBCPlugIn >> 'H2PlugIn' for ERCompositeAdaptor@1026056307 >> Feb 12 12:09:07 ERModernMoviesTest[9876] DEBUG NSLog - connecting with >> dictionary: {driver = "org.h2.Driver"; plugin = "H2PlugIn"; password = >> "<password deleted for log>"; URL = "jdbc:h2:mem:ERModernMoviesTest"; } >> Feb 12 12:09:07 ERModernMoviesTest[9876] DEBUG NSLog - === Begin Internal >> Transaction >> Feb 12 12:09:07 ERModernMoviesTest[9876] DEBUG NSLog - evaluateExpression: >> <com.webobjects.jdbcadaptor._H2PlugIn$H2Expression: "SELECT t0.ACCESS_LEVEL, >> t0.CUSTOMER_ID, RTRIM(t0.PASSWORD), RTRIM(t0.TYPE), t0.USER_ID, >> RTRIM(t0.LOGIN) FROM rentalsuser t0 WHERE (t0.TYPE = ? OR t0.TYPE = ?)" >> withBindings: 1:"app"(type), 2:"framework"(type)> >> Feb 12 12:09:07 ERModernMoviesTest[9876] DEBUG NSLog - 4 row(s) processed >> Feb 12 12:09:07 ERModernMoviesTest[9876] DEBUG NSLog - === Commit Internal >> Transaction >> FetchTask._call: ringle: app >> FetchTask._call: jboyles: app >> FetchTask._call: lstark: app >> FetchTask._call: jjeffers: framework >> >> => java.lang.IllegalStateException: Unable to find entity for object >> <webobjectsexamples.businesslogic.common.AppUser pk:"4"> >> >> Deletion with only abstract parent entity AbstractUser in FrameworkUser: >> >> ERXDatabase.addModel: FrameworkUser >> Feb 12 12:11:36 ERModernMoviesTest[9876] DEBUG NSLog - Using JDBCPlugIn >> 'H2PlugIn' for ERCompositeAdaptor@22939787 >> Feb 12 12:11:36 ERModernMoviesTest[9876] DEBUG NSLog - connecting with >> dictionary: {driver = "org.h2.Driver"; plugin = "H2PlugIn"; password = >> "<password deleted for log>"; URL = "jdbc:h2:mem:ERModernMoviesTest"; } >> Feb 12 12:11:36 ERModernMoviesTest[9876] DEBUG NSLog - === Begin Internal >> Transaction >> Feb 12 12:11:36 ERModernMoviesTest[9876] DEBUG NSLog - evaluateExpression: >> <com.webobjects.jdbcadaptor._H2PlugIn$H2Expression: "SELECT t0.ACCESS_LEVEL, >> t0.CUSTOMER_ID, RTRIM(t0.PASSWORD), RTRIM(t0.TYPE), t0.USER_ID, >> RTRIM(t0.LOGIN) FROM rentalsuser t0 WHERE t0.TYPE = ?" withBindings: >> 1:"app"(type)> >> Feb 12 12:11:36 ERModernMoviesTest[9876] DEBUG NSLog - 3 row(s) processed >> Feb 12 12:11:36 ERModernMoviesTest[9876] DEBUG NSLog - === Commit Internal >> Transaction >> FetchTask._call: ringle: app >> FetchTask._call: jboyles: app >> FetchTask._call: lstark: app >> >> => java.lang.IllegalStateException: Unable to find entity for object >> <webobjectsexamples.businesslogic.common.AppUser pk:"4"> >> >> Interestingly, the restricting qualifier is being correctly generated, i.e. >> it contains the type for "app" and for "framework" EOs. >> >> As a workaround, I add the following before the fetch >> >> >> EODatabaseContext.registeredDatabaseContextForModel(ERXModelGroup.defaultGroup().modelNamed("AppUser"), >> ec); >> >> which forces the model to be loaded. >> >> Now, my question is where can this be fixed in a generic manner? The fetch >> causes an EOCooperatingObjectStoreNeededNotification notification to be >> sent, which gets handled by >> EODatabaseContext._cooperatingObjectStoreNeeded(). But that's a static >> method… >> >> Fabian >> >> P.S.: The fetch in question takes place in an EC created with an >> EOObjectStoreCoordinator from the ERXTaskObjectStoreCoordinatorPool. AFAICT >> this is only relevant in that the EOModel is more likely to not having been >> added, compared to using an EOObjectStoreCoordinator that is shared among >> sessions. >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com >> >> This email sent to sam...@samkar.com > _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com