Select to view content in your preferred language

FileGeodatabase adding, and topology ...

366
1
06-16-2010 11:30 AM
thomaslepkowski
Emerging Contributor
Hello,

I'm trying to insert a polygon into my fileGeodatabase feature class.  Previously this worked fine, until I made the feature class participate in a topology.  Now I get

"Objects in this class cannot be updated outside an edit session" exception.

Ok, fine, so I'll make an edit session, but I get the same exception.

Here's the code:

IWorkspace workspace = fileGDBWorkspaceFactory.openFromFile( "/foo/highPitch.gdb" );
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace) workspace;

IWorkspaceEdit workspaceEdit = (IWorkspaceEdit) workspace;

//
workspaceEdit.startEditing(false);
workspaceEdit.startEditOperation();  
  
IFeatureClass featureClass = featureWorkspace.openFeatureClass("module");

IFeature newFeature = featureClass.createFeature();
newFeature.setShapeByRef(module.getPolygonElement().getGeometry());
newFeature.store();

workspaceEdit.stopEditOperation();
workspaceEdit.stopEditing(true);

Any thoughts on adding a feature to a feature class that participates in a topology?  Thanks in advance for any pointers!
0 Kudos
1 Reply
thomaslepkowski
Emerging Contributor
When initializing arcGIS Engine, you need to specify the correct license level (esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB), like so:

try {
          
com.esri.arcgis.system.AoInitialize ao = new com.esri.arcgis.system.AoInitialize();

// NOT esriLicenseProductCodeEngine
//ao.initialize(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeEngine);

//  esriLicenseProductCodeEngineGeoDB enables more geodatabase functionality, such as topology
ao.initialize(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);

} catch (Exception e) {
   // D'Oh!
}
0 Kudos