congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DBI.getTransactionHandler
Code IndexAdd Tabnine to your IDE (free)

How to use
getTransactionHandler
method
in
org.skife.jdbi.v2.DBI

Best Java code snippets using org.skife.jdbi.v2.DBI.getTransactionHandler (Showing top 1 results out of 315)

origin: rakam-io/rakam

@JsonRequest
@ApiOperation(value = "Get dashboard users")
@Path("/users/set")
public SuccessMessage setUsers(@Named("user_id") Project project, @ApiParam("dashboard") int id, @ApiParam("user_ids") int[] users) {
  TransactionHandler transactionHandler = dbi.getTransactionHandler();
  try (Handle handle = dbi.open()) {
    transactionHandler.begin(handle);
    Integer userId = handle.createQuery("SELECT user_id FROM dashboard where id = :id")
        .bind("id", id).map(IntegerMapper.FIRST).first();
    if (project.userId != userId) {
      throw new RakamException(FORBIDDEN);
    }
    handle.createStatement("DELETE FROM dashboard_permission WHERE dashboard = :dashboard")
        .bind("dashboard", id).execute();
    handle.createStatement("UPDATE dashboard SET shared_everyone = :sharedEveryone" +
        " WHERE id = :id AND project_id = :project")
        .bind("id", id)
        .bind("sharedEveryone", false)
        .bind("project", project.project)
        .execute();
    for (int user : users) {
      handle.createStatement("INSERT INTO dashboard_permission (dashboard, user_id) VALUES (:dashboard, :user_id) ")
          .bind("dashboard", id)
          .bind("user_id", user)
          .execute();
    }
    transactionHandler.commit(handle);
    return SuccessMessage.success();
  }
}
org.skife.jdbi.v2DBIgetTransactionHandler

Popular methods of DBI

  • <init>
    Constructor used to allow for obtaining a Connection in a customized manner. The org.skife.jdbi.v2.t
  • open
  • onDemand
    Create a new sql object which will obtain and release connections from this dbi instance, as it need
  • registerMapper
    Register a result set mapper which will have its parameterized type inspected to determine what it m
  • withHandle
    A convenience function which manages the lifecycle of a handle and yields it to a callback for use b
  • registerArgumentFactory
  • inTransaction
  • setSQLLog
    Specify the class used to log sql statements. Will be passed to all handles created from this instan
  • registerContainerFactory
  • setStatementLocator
    Use a non-standard StatementLocator to look up named statements for all handles created from this DB
  • setStatementRewriter
    Use a non-standard StatementRewriter to transform SQL for all Handle instances created by this DBI.
  • setTransactionHandler
    Specify the TransactionHandler instance to use. This allows overriding transaction semantics, or map
  • setStatementRewriter,
  • setTransactionHandler,
  • setTimingCollector,
  • useHandle,
  • define,
  • close,
  • getStatementLocator,
  • registerColumnMapper

Popular in Java

  • Reading from database using SQL prepared statement
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • setRequestProperty (URLConnection)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • JLabel (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now