EOModelGroup eomodelgroup = EOModelGroup.modelGroupForObjectStoreCoordinator(osc); EOModel eomodel = eomodelgroup.modelNamed(modelName); if(eomodel == null) { throw new EOObjectNotAvailableException("databaseContextForEntityNamed: cannot find model named " + modelName + " associated with this EOEditingContext"); } else { EODatabaseContext eodatabasecontext = EODatabaseContext.registeredDatabaseContextForModel(eomodel, osc); return eodatabasecontext; }
Hashtable h = osc.databaseContextsForModels(); EODatabaseContext dbc = (EODatabaseContext)h.get(modelName); return dbc;
        public static EODatabaseContext databaseContextForEntityNamed(String entityName, EOObjectStoreCoordinator osc) {            String modelName = EOModelGroup.defaultGroup().entityNamed(entityName).model().name();            EOModelGroup eomodelgroup = EOModelGroup.modelGroupForObjectStoreCoordinator(osc);            EOModel eomodel = eomodelgroup.modelNamed(modelName);            if(eomodel == null) {                throw new EOObjectNotAvailableException("databaseContextForEntityNamed: cannot find model named " + modelName + " associated with this EOEditingContext");            } else {                EODatabaseContext eodatabasecontext = EODatabaseContext.registeredDatabaseContextForModel(eomodel, osc);                return eodatabasecontext;            }        }