# changing from Servoy sequence to DB sequence

**URL:** <https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934>\
**Category:** Classic Servoy\
**Created:** [May 26, 2004, 11:16am UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934 "2004-05-26T11:16:58Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 26, 2004, 11:16am UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/1 "2004-05-26T11:16:58Z")

</div>

Hello, I have to change my sequence handling since some of our customers want to access my database from other applications. I have tried to change the sequence type on one table for testing.

Now, when I simply add a new record and step out of it, I get “Cannot save form data”, which is not true, since the record is saved.

In the log, I get the following error:

> java.lang.ClassCastExceptionjava.lang.ClassCastException  
> at com.servoy.j2db.dataprocessing.h.do(Unknown Source)  
> at com.servoy.j2db.dataprocessing.FoundSet.updateRecord(Unknown Source)  
> at com.servoy.j2db.dataprocessing.FoundSet.stopEditing(Unknown Source)  
> at com.servoy.j2db.dataprocessing.h.stopEditing(Unknown Source)  
> at com.servoy.j2db.FormPanel.saveData(Unknown Source)  
> at com.servoy.j2db.FormPanel.a(Unknown Source)  
> at com.servoy.j2db.FormPanel.valueChanged(Unknown Source)  
> at com.servoy.j2db.util.gui.o.a(Unknown Source)  
> at com.servoy.j2db.util.gui.o.a(Unknown Source)  
> at com.servoy.j2db.util.gui.o.setSelectionInterval(Unknown Source)  
> at javax.swing.JTable.changeSelectionModel(Unknown Source)  
> at javax.swing.JTable.changeSelection(Unknown Source)  
> at javax.swing.plaf.basic.BasicTableUI$NavigationalAction.actionPerformed(Unknown Source)  
> at javax.swing.SwingUtilities.notifyAction(Unknown Source)  
> at javax.swing.JComponent.processKeyBinding(Unknown Source)  
> at javax.swing.JTable.processKeyBinding(Unknown Source)  
> at com.servoy.j2db.util.gui.FixedJTable.processKeyBinding(Unknown Source)  
> at javax.swing.JComponent.processKeyBindings(Unknown Source)  
> at javax.swing.JComponent.processKeyEvent(Unknown Source)  
> at java.awt.Component.processEvent(Unknown Source)  
> at java.awt.Container.processEvent(Unknown Source)  
> at java.awt.Component.dispatchEventImpl(Unknown Source)  
> at java.awt.Container.dispatchEventImpl(Unknown Source)  
> at java.awt.Component.dispatchEvent(Unknown Source)  
> at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)  
> at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)  
> at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)  
> at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)  
> at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)  
> at java.awt.Component.dispatchEventImpl(Unknown Source)  
> at java.awt.Container.dispatchEventImpl(Unknown Source)  
> at java.awt.Window.dispatchEventImpl(Unknown Source)  
> at java.awt.Component.dispatchEvent(Unknown Source)  
> at java.awt.EventQueue.dispatchEvent(Unknown Source)  
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)  
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)  
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)  
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)  
> at java.awt.EventDispatchThread.run(Unknown Source)

Any ideas of what I might be doing wrong?

Thanks  
Patrick

P.S.: I have set up a completely new solution with only one form using that table. There was no error…

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 30, 2004, 6:50am UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/2 "2004-05-30T06:50:00Z")

</div>

Hello, does anybody have an idea about this? I have changed some more tables and keep on getting these errors. Currently, I am out of business… Any help is greatly appreciated.

Thanks  
Patrick

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [May 30, 2004, 2:05pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/3 "2004-05-30T14:05:56Z")

</div>

This is not really my cup of tea, but have you tried refreshing the sequence (synchronizing). I think there’s an option for this under the advances/options section of dataproviders…

Maybe that will solve your issue.

Paul

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 30, 2004, 2:38pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/4 "2004-05-30T14:38:17Z")

</div>

Thanks, I did. But actually I don’t see the point in refreshing a sequence when the sequence is DB managed. I think in that constellation synching is not important anymore since Servoy server doesn’t take care of sequences anymore?

---

<div class="post-metadata">

**Author:** ![john.allen](https://avatars.discourse-cdn.com/v4/letter/j/dec6dc/32.png) [@john.allen](https://forum.servoy.com/u/john.allen)\
**Post date:** [May 31, 2004, 3:43am UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/5 "2004-05-31T03:43:08Z")

</div>

I have had some problems with this too although in a slightly different way when importing data. Did you just change it within Servoy or did you also go to your backend database? If it is Sybase ASA you might look at what is happening in Sybase Central (i.e. how the column is defined). The reason I say that is, as I understand it, if you create the table and columns within Servoy then that is fine. However if you do anything that would normally be an ‘ALTER table’ statement on your SQL backend, then you need to do that on your SQL tables directly. And changing a column to becoming auto-incrementing would be such a change. Providing you are doing this in a testing environment, then I would experiment with that. Otherwise you might need to wait until after the long weekend and someone more knowledgeable can respond ![:)]( "Smile")

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 31, 2004, 8:36am UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/6 "2004-05-31T08:36:47Z")

</div>

What I did is this:

1. I deleted all data in the relevant table
2. I went to the database (MS SQL) and made the primary key auto increment
3. I went back to Servoy and “told” it, that the primary key is now DB managed

Is this the way to do it?

Thanks.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [May 31, 2004, 9:35am UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/7 "2004-05-31T09:35:04Z")

</div>

yes this should be the way to do it.  
Did you change the type of the pk? (int to string or things like that)  
do you have calculations on that table in servoy?

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 31, 2004, 9:54am UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/8 "2004-05-31T09:54:11Z")

</div>

I did not change the type of the pk.

Calculations were my first guess, too. Especially when I found out, that I have no trouble using this setup with a new solution. But then I more or less disabled all calculations and the problem remains. What is especially strange about this is that the record is perfectly saved in the database…

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [May 31, 2004, 2:05pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/9 "2004-05-31T14:05:18Z")

</div>

fixed the problem (2.0.3 and greater)

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [May 31, 2004, 2:16pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/10 "2004-05-31T14:16:45Z")

</div>

Great! Thanks a lot, I am very relieved!

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [August 5, 2004, 6:52pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/11 "2004-08-05T18:52:49Z")

</div>

i just started seeing this problem today, also after setting the sequence type  
of the primary key to ‘db identy’.

now, i can’t even do:  
new record  
save record

without getting “ClassCastException”

i’m really stuck here.  
any help would be greatly apprecaiated.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [August 5, 2004, 8:26pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/12 "2004-08-05T20:26:20Z")

</div>

can you give a little more info?

what version are you using  
What kind of database, table, column

Can you send a small example?

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [August 5, 2004, 9:09pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/13 "2004-08-05T21:09:31Z")

</div>

build 276  
mac os-10.3  
java 1.4.2

db is mysql, running on same machine.

the problem does not appear to be specific to any  
particular column.

don’t have a small example, sorry. the solution is quite large.

only clue so far: if i create a new form, with only one or two  
fields on it, i can do the new/save sequence without problems.  
however, if i add a calculation to the form (apparently any calculation),  
i get the error when trying to save data. after that, removing the  
calculation from the form does not solve the problem: creating  
a new record and then selecting save data gets the error.  
closing and reopening the solution does solve the problem,  
unless i add a calcuation to the form again. this is bringing my  
work to a halt today…

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [August 5, 2004, 9:26pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/14 "2004-08-05T21:26:28Z")

</div>

can you look in youre .log.txt file?  
Or start the developer with -DSTACKTRACE=TRUE?

and see what you exactly get?

Also can you test this solution on 2.1RC2?

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [August 5, 2004, 10:53pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/15 "2004-08-05T22:53:04Z")

</div>

here are two text files that show excerpts from the terminal  
sessions of a working session and a broken session.

i see that the “broken” session has some additional  
sql at the top.

the only thing different in the broken session is that i’ve  
placed a simple calculation on the form. once i add the  
calc, and it breaks, i replace the code with something  
very simple, but the code still continues to break, until  
i remove the calc from the form, close & reopen the  
solution.

also of interest, and this has caused me some problems  
in the past, whenever i create a new record in this table,  
two of the fields (columns) in the table are set to zero,  
where every other field is set to null. i’ve been working  
around this for a while, but just noticed in this log file that  
those two fields appear to get set to zero by servoy.  
their numbers are 46 & 82, and you can see where this  
is happening in both log files.

thank you very much for your help with this.  
rm.

(p.s., i can not get the text files to attach to this posting,  
so i’ll e-mail them to you)

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [August 6, 2004, 3:11pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/16 "2004-08-06T15:11:14Z")

</div>

a further complication of this is, i’m trying to debug a calculation  
that seems to cause the error to occur, and having a very difficult  
time.

it seems that commenting out lines of the calculation (lines that  
i suspect might be part of the problem) doesn’t cause the problem  
to go away, but completely deleting those lines does.

could you tell me: if calls to other calculations are in a calculation,  
but commented out, do they still have some effect on how servoy  
does things?

this is still a big problem here, and causing us to get behind schedule.

thanks again for any assistance.  
rm.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [August 6, 2004, 4:06pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/17 "2004-08-06T16:06:44Z")

</div>

i don’t know exactly how those things are related  
it looks like that it has something to do with calculation and db indentity columns

But i really need a sample solution for this to test it rigth away

---

<div class="post-metadata">

**Author:** ![RobertMeyer](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@RobertMeyer](https://forum.servoy.com/u/RobertMeyer)\
**Post date:** [August 6, 2004, 7:37pm UTC](https://forum.servoy.com/t/changing-from-servoy-sequence-to-db-sequence/1934/18 "2004-08-06T19:37:12Z")

</div>

i’ll export it and e-mail it to you.

thanks.  
rm.
