How ist it possible that the sequence I retrieve within Smart Client is different from the sequence I retrieve when starting Smart Client from within developer? The database is the same. One sequence is 23 the other 2022327.
If I understand the architecture right, the runtime client accesses the Servoy application server (Java app) on the server. The smart client, launched from within developer, uses a ‘small’ Servoy application server on the client and the Servoy application server on the server. If I get two different sequences, I guess, the sequence is stored in the clients application server? Is my picture of the architecture right?
If I open a table in the developer, select a column, calculate servoy sequence from data for a pk and update the repository, is this the same as updating sequences for all tables on servoy admin page?
Developer Smart Client = I press the buttton ‘Start SmartClient’ from within developer.
To test that everything runs fine, I start the (Runtime or ‘Real’) Smart Client from anywhere (my laptop, PC from home, on the server or any other machine). On the same server on the same Database.
So, are there different places to store the sequence?
I am not 100% sure but I don’t think Debug Smart Client will be using any sequences stored in the repository DB but from the workspace itself. So that might explain the behavior you see.
birgit:
Developer Smart Client = I press the buttton ‘Start SmartClient’ from within developer.
To test that everything runs fine, I start the (Runtime or ‘Real’) Smart Client from anywhere (my laptop, PC from home, on the server or any other machine). On the same server on the same Database.
So, are there different places to store the sequence?
ah yes indeed, the developer works with your workspace, and the server, works with your db repository!
May I write this in my words to make sure, I understood it right? It means, the sequence is stored in the repository? And this value is used by (runtime) clients only?
I was looking now for the sequence in my workspace files and couldn’t find it. Any idea, where it is saved? Not that I really need to know. Just curious.
Clients in ApplicationServer (both webclient and smartclient) use the repository to keep track of the next servoy sequence value.
In Developer we have no repository, so we do a ‘select max(pk)’ instead.
This way it can happen that 2 developers using the same db use the same PK value, but that does not happen often.
Ah, now I understand the behaviour. Thank you for the answer!
Sometimes it is unimportant to understand Servoy implementation details. But sometimes the behaviour is unexpected and does not fit the picture I have in my mind. Then I appreciate documentation or forum replies a lot.
I made some tests, Rob, and I’d like to reopen the topic:
Your answer, that the sequence in the Developer Smart Client (DSC) is calculated, is only half true. I state: The first value is calculated (max(id) +1). But from then on the number is incremented, even if I don’t save the object and therefore max(id) does not change. So, the question stays: Where is this sequence stored? I read in the beginners handbook of Adrian McGilly that there is a “mini-version of Servoy Server” running on the client. Can you explain what this is? Does this mini server store the sequence?
I see the danger, that debugging an application, may break the customers sequences. Do you agree: After debugging (with creation of objects), I’m forced to ‘update servoy sequences for all tables’ to guarantee that the runtime Servoy Clients works correct again?
Actually, I would appreciate Adrian McGillys architecture diagram - even in more detail - in one of the official Servoy Handbooks.
ad 1.
In addition to the select max()+1, there is an in-memory cache for the sequence to prevent sequence clashing when you create multiple records without saving.
This is only in memory and works for the clients running inside developer, after developer restart a new select-max is done and the cache is not shared between other developers working on the same db.
In developer we have a repository running that is based on the files in your workspace, this is the one managing the sequences for developer.
ad 2.
That is a danger indeed, if you connect with developer directly to a production db, sequences in the repository for the regular servoy clients are out-dated.
Better to debug issues on a copy of the production db to prevent issues like this.
You are right, if you do need to work on the production db, you need to synch sequences again.
This is not needed if you use db sequences, identity columns or uuid generated columns.