3

I have a versioned geodatabase. Any of that versions are used only by one user. So then user called "XXX" has a version called "XXX". So then now I want to make a changes on given version, but when I create a code like that:

IWorkspaceEdit edit = null;
    try {
        edit = new IWorkspaceEditProxy(findVersion(getVersionedWorkspace(), "myVersion"));
        edit.startEditing(true);
        edit.startEditOperation();
        IFeatureWorkspace featureWorkspace = new IFeatureWorkspaceProxy(getWorkspace());
        ITable iTable = featureWorkspace.openTable("MyTable");
        IRow iRow = iTable.getRow(56);
        StringBuilder builder = new StringBuilder();
        iRow.setValue(21, "test2");
        iRow.store();
        edit.stopEditOperation();
        edit.stopEditing(true);
    } catch (IOException e) {
        e.printStackTrace();
    }

I get an exception:

AutomationException: 0x80041354 - Syntax error in 'Microsoft VBScript compilation error'

When I call this method again a get an information like I should use an edit session

Objects in this object class cannot be updated outside of an edit session.

but how you can see on above code, I start and stop editing and edit operation.

Anyone can give me any hint for that. I also using an IFeatureWorkspace.update method, but I get an information about problem with edit session. I'm not sure what I'm doing wrong, because I can access to database and get rows, but I can't edit them. I am using a JAVA as programming language.

When I change my code into:

IWorkspace iWorkspace = ArcGISServerHelper.getInstance().getWorkspace();
IWorkspaceEdit edit = null;
try { 

    IVersionedWorkspace iVersionedWorkspace = new IVersionedWorkspaceProxy(iWorkspace);
    iWorkspace = new IWorkspaceProxy(iVersionedWorkspace.findVersion("myVersion"));

    edit = new IWorkspaceEditProxy(iVersionedWorkspace.findVersion("myVersion"));
    IFeatureWorkspace featureWorkspace = new IFeatureWorkspaceProxy(iWorkspace);
    ITable iTable = featureWorkspace.openTable("MyTable");
    edit.startEditing(true);
    edit.startEditOperation();

I get an exception:

AutomationException: 0x80004005 - The XML being loaded could not be parsed. [physical name: OWNER.ANNO_TABLE] in 'ESRI GeoDatabase'

1
  • Try ITableEdit and IRowEdit
    – patrick
    Commented Jan 9, 2012 at 21:43

1 Answer 1

2

Why are you doing this

IFeatureWorkspace featureWorkspace = new IFeatureWorkspaceProxy(getWorkspace());

when you already have the workspace in the "edit" object? My spidy senses are telling me that the workspace returned by getWorkspace() is not the same as the one that you get from

edit = new IWorkspaceEditProxy(findVersion(getVersionedWorkspace(), "myVersion"));

so your StartEditing call and the StartEditOperation have been on a different Version altogether.

Instead, to get the featureWorkspace do

IFeatureWorkspace featureWorkspace = edit as IFeatureWorkspace;
3
  • You have right, but when I tried IFeatureWorkspace featureWorkspace = new IFeatureWorkspaceProxy(edit); I have an exception like AutomationException: 0x80004005 - The XML being loaded could not be parsed. [physical name: OWNER.ANNO_TABLE] in 'ESRI GeoDatabase'
    – yaotzin
    Commented Jan 10, 2012 at 7:19
  • Ah, Java-land. Why are you getting an annotation table error during a workspace Query Interface? Is that Table valid? Commented Jan 10, 2012 at 22:56
  • Open ArcCatalog and preview it. Commented Jan 13, 2012 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.