UpdateScript is the interface defined in MetaModel which comprises a series of updates/changes to a datastore.  

The interface is meant for you to implement on your own in order to define the series of changes (script) that you wish to commit to the underlying database. You do this in a manner like this:

dataContext.executeUpdate(new UpdateScript() {
	public void run(UpdateCallback callback) {
		// Perform updates here by calling methods on 'callback'.
	}
});

You can optionally choose to use the BatchUpdateCallback class which may be beneficial in certain situations. See for example JdbcDataContext for details about JDBC batch updates.  

In addition there are a few single-update implementations available for you to use:  

  • InsertInto
  • Update
  • DeleteFrom
  • CreateTable
  • DropTable

These classes all implement UpdateScript with the intent of doing a single atomic change only.

  • No labels