In my rapidclipse 4.0 project, I have to read data out of a database view, while saving manual entered data. The readed value should then be included into the data to be saved.
My problem is, that this works fine, only onetime/ the first save. If I save a second time, the value is not updated.
In the save-button click event I placed following code:
private void cmdSave_buttonClick(final Button.ClickEvent event) {
try {
this.txtDmvTable.setValue("T_supplier");
final int i = 1;
VSuppliersNewId vsni = new VSuppliersNewId();
vsni = new VSuppliersNewIdDAO().find(i);
this.txtDmvCol00.setValue(vsni.getNewSupId().toString());
this.fieldGroup.save();
}
catch(final Exception e) {
e.printStackTrace();
Notification.show("Do isch was falsch",
e.getMessage(),
Notification.Type.ERROR_MESSAGE);
}
}
The following lines did exactly what expected, but only one time:
final int i = 1;
VSuppliersNewId vsni = new VSuppliersNewId();
vsni = new VSuppliersNewIdDAO().find(i);
this.txtDmvCol00.setValue(vsni.getNewSupId().toString());
The view VSuppliersNewId
will always give back only one uptodate value.
For example:
- My view gives back the highest value out of a table field.
- Lets asume in the first round it gives back the number
237
- After saving my data, the view will give back perhaps
238
- If I read this direct by sql in the database I get back
238
- but by the above code it still persists the
237
I assume, that the whole code chain from database has to be refreshed/ reloaded, but it didn't.
How to change/enhance my code to get the expected result? What did I wrong?