Hi, everybody.
I want to make a query for find duplicates in a geodatabase using Java and arcobjects (Argis v10). I have the next code in Java:
public void getDuplicate(IFeatureClass fClass, Workspace wS) throws IOException{
String field = "DLLAVE, COUNT(*) AS C";
String postfix = "GROUP BY DLLAVE HAVING C > 1";
String where = fClass.getOIDFieldName()+" IS NOT NULL";
IFeatureWorkspace fw = wS;
IQueryDef2 query = (IQueryDef2) fw.createQueryDef();
query.setPostfixClause(postfix);
query.setSubFields(field);
query.setWhereClause(where);
query.setTables(fClass.getAliasName());
ICursor search = query.evaluate2(true);
IRow row = search.nextRow();
while(row != null){
String id = (String) row.getValue(search.findField("DLLAVE"));
String cont = (String) row.getValue(search.findField("C"));
System.out.println("IDLLAVE: "+id);
System.out.println("COUNT: "+cont);
row = search.nextRow();
}
}
But.... throw the next exception:
IQueryDefProxy cannot be cast to com.esri.arcgis.geodatabase.IQueryDef2Proxy
Help me =(
Does anyone know how to get a IQueryDef2?
Note: Sorry for my english.