Hi, One option might be to have a background thread updating the database once every few seconds or so, if the dirty flag is set.
Regards, Thomas On Sat, Feb 4, 2017 at 12:48 PM, vicenrico <[email protected]> wrote: > Hello. I don't know how h2 database works internally, so I would like to > ask a question: > > In my code I have this: > > ud3Text.addModifyListener(new ModifyListener() { > @Override > public void modifyText(ModifyEvent arg0) { > if (!ud3Text.isFocusControl()) > return; > model.setUserDataValue3(ud3Text.getText().trim()); > model.update(); > } > }); > > With this code, every time the user press a key into the userdata field (a > text field), is database updated?. I mean, it would be better, instead > doing update every keypress, use a model.setdirty(true) flag and doing > update before the program closes? > I say that because I think that with the update as above, the program is > writing to disk every keypress and that's not good. But I suppose perhaps > h2 database is optimized not to write all the time but only from time to > time. > Can anyone explain to me that? Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
