You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metamodel.apache.org by Apache Wiki <wi...@apache.org> on 2016/08/08 04:15:41 UTC

[Metamodel Wiki] Update of "UpdateScript" by KasperSorensen

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Metamodel Wiki" for change notification.

The "UpdateScript" page has been changed by KasperSorensen:
https://wiki.apache.org/metamodel/UpdateScript

New page:
= UpdateScript =

!UpdateScript is the interface defined in MetaModel which comprises a series of [[UpdatingData|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.