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…
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
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
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?
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 :)]()
What I did is this:
- I deleted all data in the relevant table
- I went to the database (MS SQL) and made the primary key auto increment
- I went back to Servoy and “told” it, that the primary key is now DB managed
Is this the way to do it?
Thanks.
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?
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…
fixed the problem (2.0.3 and greater)
Great! Thanks a lot, I am very relieved!
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.
can you give a little more info?
what version are you using
What kind of database, table, column
Can you send a small example?
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…
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?
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)
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.
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
i’ll export it and e-mail it to you.
thanks.
rm.