EOEntity entity = entity();
EOEntity entity = entity(ec);
    public Number objectCountWithQualifier(EOEditingContext ec, EOQualifier qualifier) {        String entityName = entityName();                NSArray results = null;        EOAttribute attribute = EOGenericRecordClazz.objectCountAttribute();        EOEntity entity = entity();        EOQualifier schemaBasedQualifier = entity.schemaBasedQualifier(qualifier);        EOFetchSpecification fs = new EOFetchSpecification(entityName, schemaBasedQualifier, null);        synchronized (entity) {            entity.addAttribute(attribute);            fs.setFetchesRawRows(true);            fs.setRawRowKeyPaths(new NSArray(attribute.name()));            results = ec.objectsWithFetchSpecification(fs);            entity.removeAttribute(attribute);        }        if ((results != null) && (results.count() == 1)) {            NSDictionary row = (NSDictionary) results.lastObject();            return (Number)row.objectForKey(attribute.name());        }        return null;    }