Objects in this class cannot be updated outside an edit session

3085
1
07-20-2013 02:33 AM
IshanKaushik
New Contributor
HI,

I am trying to delete selected features of a feature class . FOllowing is what i am trying to edit a PGDB --

 private void openFromFile_pGDB_Workspace(String inPGDB)throws Exception{
  IWorkspaceFactory workspaceFactory = new AccessWorkspaceFactory();
  IWorkspace workspace = new Workspace(workspaceFactory.openFromFile(inPGDB, 0));
  IFeatureWorkspace ifw = (IFeatureWorkspace) workspace;
  IFeatureClass ifetclass =  ifw.openFeatureClass("CPAnode");
  IWorkspaceEdit iwe = (IWorkspaceEdit)workspace;
  iwe.startEditing(true);
  iwe.startEditOperation();
     IFeatureCursor ifc = ifetclass.search(null, true);
     int field = ifc.findField("CONSTRUCTIONSTATUS");
     System.out.println("CONSTRUCTIONSTATUS :"+field);
     IFeature iff = ifc.nextFeature();
     while((iff = ifc.nextFeature()) != null)
     {
      
         iff.setValue(field, null);
         iff.store();
         
     }
  iwe.stopEditOperation();
  iwe.stopEditing(true);
    
     
   }


This if what i am getting in console ---

CONSTRUCTIONSTATUS :5
AutomationException: 0x80041354 - Objects in this class cannot be updated outside an edit session [CPAnode] in 'ESRI GeoDatabase'
at com.esri.arcgis.geodatabase.SimpleJunctionFeature.store(Unknown Source)
at avineon.Delete.openFromFile_pGDB_Workspace(Delete.java:137)
at avineon.Delete.main(Delete.java:85)
Error: AutomationException: Objects in this class cannot be updated outside an edit session [CPAnode]
Sample failed.  Exiting...


I am getting a hard time to edit these feature , if this is not the correct way to edit features than what else should i try.
0 Kudos
1 Reply
IshanKaushik
New Contributor
Ok it was a license problem i made it working on editor license on a different system , but in documentation it says that you can edit with an engine license if you have update extention , as stated in following link in last section "ADITIONAL REQUIREMENT"--

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000010s000000

So my question is --

I am having engine license in one system which has all extension initialised and in one editor license initialised , so why did the above code only worked for editor lisence , do i need to modify my code to make it work on engine licence ?
0 Kudos