databaseManager.saveData oddity [SOLVED]

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

databaseManager.saveData oddity [SOLVED]

Postby steve1376656734 » Thu Mar 28, 2019 6:53 pm

I am facing an issue where I cannot save some records and cannot figure out why. I have set a breakpoint where I think the problem is occurring and this is what I find:

1. I have some edited records which I confirmed by running databaseManager.getEditedRecords()
2. I run databaseManager.saveData() which returns false. From this, I assume the records have not been saved for some reason.
3. I run databaseManager.getFailedRecords() which returns no records.
4. I run databaseManager.getEditedRecords which shows the same records as in step 1.

debug.png
debug.png (235.17 KiB) Viewed 285 times

During the above there are no errors shown in the developer console, no errors in the Servoy log and no SQL is issued to the database.

Can anyone suggest what may be happening?

Thanks.
Last edited by steve1376656734 on Thu Jul 11, 2019 5:16 pm, edited 1 time in total.
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 224
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: databaseManager.saveData oddity

Postby Manolo_Etec » Fri Mar 29, 2019 10:08 am

Hi Steve.
When I have this problem, normaly is because a have in an entity a condition that return false or when there is a duplicate pk, but normaly it return an error of duplicate pk that you can see....
Manuel López
Etec Programación SL
manuel@etecsoft.com
http://www.etecsoft.com

Servoy 8.2.2
Windows 10
Yesterday: Java 1.8.0_141-b15
User avatar
Manolo_Etec
 
Posts: 60
Joined: Fri Sep 12, 2008 3:58 pm

Re: databaseManager.saveData oddity

Postby dev-ws-011 » Tue Apr 16, 2019 11:13 am

Hi Steve,

The reason for save to fail can be as follows:

    1. Column is updated with duplicate pk after new/edit record.
    2. Column data type mismatch e.g. date is expected but string is passed.
    3. Data validation failure for not null on column has occurred.
Check for above mentioned probable issues. Hope this will resolve you problem.

Thanks.
Servoy Developer
dev-ws-011
 
Posts: 18
Joined: Fri Oct 21, 2016 8:23 am

Re: databaseManager.saveData oddity

Postby steve1376656734 » Tue Apr 16, 2019 12:08 pm

Thanks both for the suggestions but unfortunately I cannot tell what the issue was as it appears to have stopped happening without any changes to the code!
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 224
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: databaseManager.saveData oddity

Postby ROCLASI » Tue Apr 16, 2019 12:18 pm

Hi Steve,

I am not sure if you did but perhaps for next time, also check the PostgreSQL log(s) for exceptions.

Hope this helps.
Robert Ivens
ROCLASI Software Solutions / JBS Group, Partner
SAN Developer / Servoy Valued Professional / Servoy Certified Developer
Twitter: @roclasi / @servoyforge
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5311
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: databaseManager.saveData oddity [SOLVED]

Postby steve1376656734 » Thu Jul 11, 2019 5:20 pm

OK so the same problem cropped up again today with a different table and I was able to finally track down the root cause.

We have a table filter applied to the table in question that does the same job as a tenant flagged column (old solution that has not been upgraded to take advantage of the new functionality yet). The record I was trying to save had a null value in this field and causes this exact same behaviour. Moral of the story, make sure your filtered fields have a value that will allow the record to be read back from the DB when it is saved or else it causes major problems!!
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 224
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests