Servoy 7.4.1

Servoy announcements

Re: Servoy 7.4.1

Postby tgs » Fri Jan 16, 2015 10:51 am

[fix] SVY-6423 Update/insert failed, unexpected nr of records affected: expected 1, actual 0

This issue is back in Servoy 7.4.2!

The SQL update failed, no data is saved to the database and clients get the error message dialog "cannot save data".

The complete error log from servoy_server:
Code: Select all
com.servoy.j2db.util.ServoyException: Update/insert failed, unexpected nr of records affected: expected 1, actual 0
     at com.servoy.j2db.server.dataprocessing.Zw.Za(Zw.java:1088)
     at com.servoy.j2db.server.dataprocessing.Zw.performUpdates(Zw.java:479)
     at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
     at sun.rmi.transport.Transport$1.run(Transport.java:177)
     at sun.rmi.transport.Transport$1.run(Transport.java:174)
     at java.security.AccessController.doPrivileged(Native Method)
     at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
     at java.lang.Thread.run(Thread.java:745)


Is there a workaround for this, because it is a major problem for our customers if the data is not stored to the database!?

Server:
Servoy version 7.4.2 -releaseNumber 2033
java.version=1.7.0_71
os.name=Mac OS X
os.version=10.9.5

Clients:
Windows 7 64bit
Java 1.7.0_71
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Re: Servoy 7.4.1

Postby rgansevles » Fri Jan 16, 2015 7:16 pm

Hi Thomas,

This error indicates that Servoy wanted to do an update or a delete and the datase driver indicated nothing has actulaly changed.

The Servoy Wiki describes some situations and a setting that turns this exception into a warning:
https://wiki.servoy.com/pages/viewpage. ... Id=8061867

Best to find the cause of this.
Does the log file also show the sql statement that was failing?

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Servoy 7.4.1

Postby tgs » Fri Jan 16, 2015 7:46 pm

Hi Rob,

thank you for your reply.

I will read the Errors & Warnings wiki and perhaps I am able to indicate the error.

The log file also shows the sql statment that was failing:
Code: Select all
Error executing sql: update sped_auftrag set date_modification=?, uid_rec_modification=?, auftrag_dat=?, kunden_nr=?, ladeadr_nr=?, entladeadr_nr=?, anschrift_kunde=?, anschrift_ladeadresse=?, anschrift_entladeadresse=?, kurzansch_kunde=?, kurzansch_ladeadresse=?, kurzansch_entladeadresse=?, region_kunde=?, text_zusatztext=?, text_sonstiges=?, fax_nr_kunde=?, artikel_nr=?, artikel_bezeichnung=?, menge=?, einheit=?, einzelpreis_re=?, einzelpreis_tpgs=?, berechnung_re=?, berechnung_tpgs=?, berechnung_vgs=?, toleranz_menge=?, ust_satz=?, uid_kunde=?, email_kunde=?, uid_artikel=?, uid_ladeadresse=?, uid_entladeadresse=?, ust_satz_transporteur=?, ust_satz_vermittler=?, select_text_1_auftragbest_int=?, select_text_1_tpauftrag_int=?, uid_mandant=?, menge_fahrten=?, mandant_st_schluessel=?, menge_transportiert=?, kunde_firma=?, kunde_ort=?, ladeadresse_firma=?, ladeadresse_ort=?, entladeadresse_firma=?, entladeadresse_ort=?, text_lock=?, check_dispoplan_int=?, menge_auftrag=?, menge_auftrag_rest=?, uid_real_client_group=? where uid_auftrag = ? and uid_real_client_group = ? with params: [2015-01-16 16:10:37.788 ,type: java.sql.Timestamp, '23' ,type: java.lang.String, 2015-01-16 16:11:22.524 ,type: java.sql.Timestamp, 10075 ,type: java.lang.Integer, 32435 ,type: java.lang.Integer, 32367 ,type: java.lang.Integer, 'xxx' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 'Inland' ,type: java.lang.String, '' ,type: java.lang.String, 'Lade- und liefernummer: ' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 1161 ,type: java.lang.Integer, 'Silicium metal, lose' ,type: java.lang.String, 25.0 ,type: java.lang.Double, 'to' ,type: java.lang.String, 49 ,type: java.math.BigDecimal, 44 ,type: java.math.BigDecimal, 'Einheit' ,type: java.lang.String, 'Einheit' ,type: java.lang.String, 'Einheit' ,type: java.lang.String, 5.0 ,type: java.lang.Double, 19.0 ,type: java.lang.Double, 23413 ,type: java.lang.Integer, 'info@xxx' ,type: java.lang.String, 1809 ,type: java.lang.Integer, 33281 ,type: java.lang.Integer, 32983 ,type: java.lang.Integer, 19.0 ,type: java.lang.Double, 19.0 ,type: java.lang.Double, 1 ,type: java.lang.Long, 1 ,type: java.lang.Long, 6 ,type: java.lang.Integer, 1.0 ,type: java.lang.Double, 23 ,type: java.lang.Integer, 0.0 ,type: java.lang.Double, 'xxx' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 'Anglefort' ,type: java.lang.String, 'xxx' ,type: java.lang.String, 'Ranshofen' ,type: java.lang.String, 'Berechnungsart geändert von in Einheit am 16.01.2015 16:11[Maciek] Menge Fahrten: 1 am 16.01.2015 16:11 [Maciek] Bestellmenge: 25 to am 16.01.2015 16:11 [Maciek] Auftragsmenge: 25 to am 16.01.2015 16:11 [Maciek] KD-Auftrag erstellt am: 16.01.2015 16:11 [Maciek] ' ,type: java.lang.String, 1 ,type: java.lang.Long, 25.0 ,type: java.lang.Double, 25.0 ,type: java.lang.Double, 'client1' ,type: java.lang.String, 40762 ,type: java.lang.Long, 'client1' ,type: java.lang.String]

A table filter is set by 'client1', 'client2'... because of differnt customers (clients) are using the solution. But this is working for years without code changes. I don't touched the code for that and also the PSQL behind is stiil 9.3.
It's also strange that the same issue occurs only on some clients and not always.

Regards
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Re: Servoy 7.4.1

Postby tgs » Mon Jan 19, 2015 4:32 pm

I think the table filter in my solution occurs the error "Update/insert failed, unexpected nr of records affected: expected 1, actual 0".

I have checked my code, but the table filter id will be set even a new record is created (like in the past as it worked).
Because I had to fix this problem immediately, I have disabled the table filter function and switched every client to his own sql db. This cost me the whole weekend.

Today Servoy is working without problems and errors, but this can't be the solution!

Regards
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Re: Servoy 7.4.1

Postby jcompagner » Thu Jan 22, 2015 10:32 am

Thomas, as rob already explained this is not directly a problem in servoy, and you could just turn this error off (or make it just a warning) see the wiki page.

But it is better to look at the actual cause, because the code (the client) expects that it would update (or insert) a record into the database, but the database reports that nothing is really changed
So no record is updated or inserted, which should really have happened because an update or insert statement was send to the database to update a record.

So the question is should the update statement for that record really have happened for that client?
so look at the where part: where uid_auftrag = 40752 and uid_real_client_group = 'client1'

does that where part hit a record? and if not why? is that auftrag record (with id 40752) really belonging to another client?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Servoy 7.4.1

Postby tgs » Sat Jan 24, 2015 11:55 am

Hi Johan,

jcompagner wrote:Thomas, as rob already explained this is not directly a problem in servoy, and you could just turn this error off (or make it just a warning) see the wiki page.

Ok, I have read this, but changing the server setting "servoy.server.throwErrorOnUnexpectedUpdateCount" to false is not saving the problem and I don't get the log entry with the missing values, or?

jcompagner wrote:But it is better to look at the actual cause, because the code (the client) expects that it would update (or insert) a record into the database, but the database reports that nothing is really changed
So no record is updated or inserted, which should really have happened because an update or insert statement was send to the database to update a record.

So the question is should the update statement for that record really have happened for that client?
so look at the where part: where uid_auftrag = 40752 and uid_real_client_group = 'client1'

does that where part hit a record? and if not why? is that auftrag record (with id 40752) really belonging to another client?

I have filtered the sql table by the record id and could find it. The record was created and stored to the sql table but without the data and over all the value for the table filter id (uid_real_client_group = 'client1').
As I understand is that the problem because of the table filter function. For a successful update the record id AND the table filter id is needed, or? But in my case, only the record id exists and the error occurs.

For me it is very difficult to understand how I could fix that. The error occurs sporadic currently only on one table. On perhaps one of five new records the client gets the error dialog "Cannot save data".
In the code for creating a new record, the table filter id will be set even of newRecord() followed by a databaseManager.saveData(). Is there any other way to make this better?

Regards
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Re: Servoy 7.4.1

Postby Harjo » Sat Jan 24, 2015 4:19 pm

you need to make sure, when you create a new record, it directly follows by setting your tenant-id and than do databaseManager.saveData()

so like this:

var record = foundset.getRecord(foundset.newRecord())
record.tenantid = 'client1'
databaseManager.saveData(record)

when you switch the last two lines, you will get the error you mentioned, when you have databasefilters on tenantid active.
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Servoy 7.4.1

Postby tgs » Sat Jan 24, 2015 8:06 pm

Thank you Harjo for your reply!

My code is similar to yours and of course I make the .saveData() AFTER setting the tenantid.
Anyway, I will get into my code again and modify it like your example if necessary.

Have a nice weekend!
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Previous

Return to Announcements

Who is online

Users browsing this forum: No registered users and 12 guests