Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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:

I change code in that way: 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'
share|improve this question
    
Try ITableEdit and IRowEdit –  patrick Jan 9 '12 at 21:43
add comment

1 Answer 1

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;
share|improve this answer
    
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 Jan 10 '12 at 7:19
    
Ah, Java-land. Why are you getting an annotation table error during a workspace Query Interface? Is that Table valid? –  Ragi Yaser Burhum Jan 10 '12 at 22:56
    
Open ArcCatalog and preview it. –  Ragi Yaser Burhum Jan 13 '12 at 1:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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