Servoy Sequence unset

Win2k Pro
Servoy 2.1.1
Sybase ASA

STR:

  1. Create a table called “template” with an id field set to Servoy sequence.
  2. Copy the table, with “copy column properties” checked.
  3. New table has servoy sequence. Add a few records in a dummy form and you’ll see that it really is sequencing.
  4. Restart servoy.
  5. Key is no longer servoy sequenced. New records have a blank id, and the second one of those will give you a “non-unique key” error that requires a lot of restarting apps and databases and generally fumbling around (at least for me) before you can get any part of the solution to work again.

Not hard to work around now that I see it happen, but this cost me about five hours of banging my head against the wall, trying to figure out how I was getting non-unique keys, and then trying to figure out why earlier records (before reset) had valid id’s, but later records didn’t.

Actually, feeling much better now that I’ve figured out how it happened. :wink:

Lemme know if you need more details.

Can you reproduce that constantly?

I just did it exactly as you describe and the sequence is kept at my place.

Yes. It is consistent here. What could be different, do you think?

I just created seven new tables by copying my ‘template’ table. Restarted servoy. Servoy seq no longer set on the id field. At least now I expect it and deal with it.

Am I really the only one this is happening to? Can anyone else reproduce this?

If not, what could possibly be the difference in my setup that would cause the table to copy, but not the servoy seq… or even more peculiar, to copy it in the current session, but then lose that property on restart?

I know I ask more than my share of newbie questions :wink: , but I assure you that this is rock-solid consistent. If it’s not a bug for anyone else, then I’m concerned about the setup of my development environment.

Perhaps if we go back a step? This template table was originally part of another solution. Perhaps the error originated because the template table was copied from solution to solution?

This is still happening as of today.

If it’s not a ‘bug’, then it’s certainly an ‘issue’.

Can no one reproduce this? If not, can anyone help my to find and fix my own personal bug? :wink:

I cannot confirm this issue. I did exactly what you did and the sequence was remembered. Funny thing though in my case: I create seven records, sequence went to 7, restarted Servoy and the next record started with sequence 16?!

my $.02- I created a copy of a table, verified that id field was set to servoy sequence, created 7 records in the new table, restarted Servoy and found that servoy seq was TURNED OFF. I turned it back on and added a new record and the id field jumped to 16 as well.!

Upon further testing, I have not been able to re-create the servoy sequence bug, however, in all cases, when I copy a table all of the properties of the new table are NOT retained upon restart. The properties are set from the Copy Table buttin action, but are lost when you re-start Developer.

Please give it a try with Servoy 2.1.2

I’m using 2.1.2.

same here.
Servoy Developer
Version R2 2.1.2-build 315
Java version 1.4.2_04-b05 (Windows 2000)

Ok, this was a bug, it’s fixed now.

Note however that if you use a database sequence on a column and copy it, the copied column will use a Servoy Sequence since Servoy cannot create database sequences itself.

Furthermore, about the jump in sequences, that happens when you use a Servoy Sequence. In fact, it can happen with any sequence, because somebody may ask for the next sequence number and not actually use it. So NEVER count on autogenerated sequences to be sequential. The reason that Servoy Sequences differ when you restart Servoy Developer is that Servoy takes sequences in blocks of about 10 at a time to minimize database access. Thus if you don’t use all of them and restart, you’ll have a gap.

Thanks, understood!

Hello Sebastiaan,

this is interesting:

since Servoy cannot create database sequences itself.

On MS SQL, it does exactly that. If I create a table and set the sequence to db identity, I do have a sequence on that column in the database? What am I getting wrong?

Thanks
Patrick

There are two sequence type:

Database sequence: i.e., a different seperate sequence to which you have to specify the name, called db seq in Servoy developer. This is NOT created automatically.

Database identity: i.e., an autoincrement column, no named sequence has to be made, this one CAN be made by Servoy…

You probably created the second one automatically.

Exactly. Thanks for clarification.