I have written the following code:
Statement stmt=con.createStatement();
String query = "UPDATE " + table + " SET " + field + "="
+ ((DataElement)getModel().getSelectedItem()).intValue + where;
System.out.println(query);
stmt.executeUpdate(query);
stmt.close();
firePropertyChange(table+"."+field,false,true);
when I try to react to the propertyChange, my database will either respond with the value before the change or fire an exception: database locked.
How can I make sure, the database commits the query before proceeding. I have also tried to turn off auto-commit and add a con.commit(); after the stmt.close, but that doesn't change anything.
Aucun commentaire:
Enregistrer un commentaire