Update and Delete always Failed

OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
mamad
Senior Boarder
Senior Boarder
Posts: 74
Joined: Mon Jun 25, 2018 5:13 am

Update and Delete always Failed

Post by mamad » Sun Aug 12, 2018 10:16 am

hi guys
i want to update and delete some data from database in a gwt-based class according to code below :
(i copy and paste all codes from documentations)

Code: Select all

 // Update value
        security.setName("some name changed");
        metadataService.updateValue(security.restoreToMap(), new AsyncCallback<Object>() {
            @Override
            public void onSuccess(Object result) {
            }
            @Override
            public void onFailure(Throwable caught) {
            }
        });
 
        // Delete value
        metadataService.deleteValue(security.restoreToMap(), new AsyncCallback<Object>() {
            @Override
            public void onSuccess(Object result) {
            }
            @Override
            public void onFailure(Throwable caught) {
            }
        });
    }
Problem is that always onFailure method calls(i initialize tables correctly before ) and nothing delete or update from database.
why is this for ?
thanks in advance

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Update and Delete always Failed

Post by jllort » Sun Aug 12, 2018 5:10 pm

Seems you are modifying the source code, no? Are you using the OpenKM development environment for it. Anyway, first step is to check if your code really is executed. I suggest some breakpoint at the Servlet side and some Window.alert("test") from GWT side to ensure really the code is executed.

mamad
Senior Boarder
Senior Boarder
Posts: 74
Joined: Mon Jun 25, 2018 5:13 am

Re: Update and Delete always Failed

Post by mamad » Mon Aug 13, 2018 3:55 am

yeah im modifying source code and also using ova and my code execute well (i use an alert in OnFailure() method and this alert always appear when i try to update a row of table)
i just copy and paste all codes from documentations (even queries for initialize database) from link below.
https://docs.openkm.com/kcenter/view/ok ... gwt-).html
Insert and Select codes works properly but Delete and Update always failed.
Are you sure you test delete and update parts of your codes ???

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Update and Delete always Failed

Post by jllort » Tue Aug 14, 2018 1:40 pm

You might debug in what conditions arrive data in the servlet and how comes into until is executed. When you are talking about an error, do you refer to the data is not removed from the database or is raised some exception?

mamad
Senior Boarder
Senior Boarder
Posts: 74
Joined: Mon Jun 25, 2018 5:13 am

Re: Update and Delete always Failed

Post by mamad » Wed Aug 15, 2018 4:37 am

I mean data is not removed or updated in database and it does not throw any exception.

Actually onFailure() method always called when i try to update or delete.

Please consider that i am talking about the pure source code in documentation (i don't change any line of that and just add a window.alert() to onFailure method to ensure it call every time i try to update or delete)

Also i initialize database(OKM_DB_METADATA_TYPE and OKM_DB_METADATA_VALUE tables) by executing queries in documentations.

Do you test the update and delete methods yourself to ensure they works properly ???

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Update and Delete always Failed

Post by jllort » Thu Aug 16, 2018 2:18 pm

If you suspect the code is wrong, you should debug it and report the bug. The code was working an tested when was created. These sections of code come from professional version and we do not longer use it, really in the professional version we consider as deprecated and moved to a more specific solution when needed to work with custom tables rather than using these based on metadata.

Anyway should be working, an in case they are not working you should follow the code in order to discover if the method is doing what expected or not, at the end each method ends with SQL query to be executed, if the query is not right then should consider if it's an error with the code of how are you using it or how tables are registered.

mamad
Senior Boarder
Senior Boarder
Posts: 74
Joined: Mon Jun 25, 2018 5:13 am

Re: Update and Delete always Failed

Post by mamad » Tue Sep 25, 2018 5:52 am

Hi,
Finally i found the solution for this problem.
The reason of failing update and delete queries was the "Safe Mode" in MySQL Workbench.
Here is the steps to disable it:
https://stackoverflow.com/a/14232119

jllort
Moderator
Moderator
Posts: 10347
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Update and Delete always Failed

Post by jllort » Wed Sep 26, 2018 6:09 pm

We will take note about it, I supposed "safe mode" only affected Work Bench connection, not the other database connection.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests