Codota Logo
JdbcConfiguration$JdbcConfigurationBuilder.batchSize
Code IndexAdd Codota to your IDE (free)

How to use
batchSize
method
in
org.jfleet.jdbc.JdbcConfiguration$JdbcConfigurationBuilder

Best Java code snippets using org.jfleet.jdbc.JdbcConfiguration$JdbcConfigurationBuilder.batchSize (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: jerolba/jfleet

  public static void main(String[] args) throws IOException, SQLException {
    Supplier<Connection> connectionSuplier  = new MySqlTestConnectionProvider();
    try (Connection connection = connectionSuplier.get()){
      TableHelper.createTable(connection);
      CitiBikeReader<TripFlatEntity> reader = new CitiBikeReader<>("/tmp", str -> new FlatTripParser(str));
      JdbcConfiguration config = JdbcConfigurationBuilder.from(TripFlatEntity.class)
          .batchSize(100).build();
      BulkInsert<TripFlatEntity> bulkInsert = new JdbcBulkInsert<>(config);
      reader.forEachCsvInZip(trips -> {
        try {
          bulkInsert.insertAll(connection, trips);
        } catch (JFleetException | SQLException e) {
          e.printStackTrace();
        }
      });
    }
  }
}
origin: jerolba/jfleet

@TestDBs
@ValueSource(strings = { "JdbcMySql", "JdbcPosgres" })
public void longTransactionWithConstraintExceptionIsRollbacked(@WithDB JdbcDatabase database) throws Exception {
  try (Connection connection = database.getConnection()) {
    setupDatabase(connection);
    connection.setAutoCommit(false);
    JdbcConfiguration config = JdbcConfigurationBuilder.from(Employee.class)
        .batchSize(TWO_ROW_BATCH_SIZE)
        .autocommit(false)
        .build();
    BulkInsert<Employee> bulkInsert = database.getBulkInsert(config);
    try {
      bulkInsert.insertAll(connection, employeesWithConstraintError());
      connection.commit();
    } catch (SQLException e) {
      logger.info("Expected error on missed FK");
      connection.rollback();
      assertEquals(0, numberOfRowsInEmployeeTable(connection));
      return;
    }
    assertTrue(false, "Expected SQLException exception");
  }
}
origin: jerolba/jfleet

@TestDBs
@ValueSource(strings = { "JdbcMySql", "JdbcPosgres" })
public void longTransactionExecuteMultipleLoadDataOperationsTransactionaly(@WithDB JdbcDatabase database)
    throws Exception {
  try (Connection connection = database.getConnection()) {
    setupDatabase(connection);
    connection.setAutoCommit(false);
    JdbcConfiguration config = JdbcConfigurationBuilder.from(Employee.class)
        .batchSize(TWO_ROW_BATCH_SIZE)
        .autocommit(false)
        .build();
    BulkInsert<Employee> bulkInsert = database.getBulkInsert(config);
    bulkInsert.insertAll(connection, employeesWithOutErrors());
    // We don't know how many load data operations were executed, but with
    // low batch size, multiple load data are executed with few records.
    assertEquals(7, numberOfRowsInEmployeeTable(connection));
    connection.rollback();
    assertEquals(0, numberOfRowsInEmployeeTable(connection));
  }
}
origin: jerolba/jfleet

@TestDBs
@ValueSource(strings = { "JdbcMySql", "JdbcPosgres" })
public void multipleBatchOperationsExecuteMultipleLoadDataOperationsWithHisOwnTransaction(
    @WithDB JdbcDatabase database) throws Exception {
  try (Connection connection = database.getConnection()) {
    setupDatabase(connection);
    JdbcConfiguration config = JdbcConfigurationBuilder.from(Employee.class)
        .batchSize(TWO_ROW_BATCH_SIZE)
        .autocommit(true)
        .build();
    BulkInsert<Employee> bulkInsert = database.getBulkInsert(config);
    try {
      bulkInsert.insertAll(connection, employeesWithConstraintError());
    } catch (SQLException e) {
      logger.info("Expected error on missed FK");
      assertTrue(numberOfRowsInEmployeeTable(connection) > 0);
      return;
    }
    assertTrue(false, "Expected SQLException exception");
  }
}
org.jfleet.jdbcJdbcConfiguration$JdbcConfigurationBuilderbatchSize

Popular methods of JdbcConfiguration$JdbcConfigurationBuilder

  • build
  • from
  • <init>
  • autocommit

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Kernel (java.awt.image)
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JList (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now