EOEntity entity = EOModelGroup.defaultGroup().entityNamed(entityName);
EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName);
    public static NSDictionary primaryKeyDictionaryForEntity(EOEditingContext ec, String entityName) {        // FIXME: Should use the modelgroup for the root object store of the        //	  editing context.        EOEntity entity = EOModelGroup.defaultGroup().entityNamed(entityName);        EODatabaseContext dbContext = EODatabaseContext.registeredDatabaseContextForModel(entity.model(), ec);        NSDictionary primaryKey = null;        try {            dbContext.lock();            EOAdaptorChannel adaptorChannel = dbContext.availableChannel().adaptorChannel();            if (!adaptorChannel.isOpen())                adaptorChannel.openChannel();            NSArray arr = adaptorChannel.primaryKeysForNewRowsWithEntity(1, entity);            if(arr != null)                primaryKey = (NSDictionary)arr.lastObject();            else                log.warn("Could not get primary key for entity: " + entityName + " exception");            dbContext.unlock();        } catch (Exception e) {            dbContext.unlock();            log.error("Caught exception when generating primary key for entity: " + entityName + " exception: " + e, e);        }        return primaryKey;    }