Class MultiRowsBatchInsertCrud<T,K>

java.lang.Object
org.simpleflatmapper.jdbc.impl.MultiRowsBatchInsertCrud<T,K>
All Implemented Interfaces:
Crud<T,K>

public final class MultiRowsBatchInsertCrud<T,K> extends Object implements Crud<T,K>
  • Constructor Details

  • Method Details

    • create

      public void create(Connection connection, T value) throws SQLException
      Description copied from interface: Crud
      insert value into the db through the specified connection.
      Specified by:
      create in interface Crud<T,K>
      Parameters:
      connection - the connection
      value - the value
      Throws:
      SQLException - if an error occurs
    • create

      public void create(Connection connection, Collection<T> values) throws SQLException
      Description copied from interface: Crud
      insert values into the db through the specified connection.
      Specified by:
      create in interface Crud<T,K>
      Parameters:
      connection - the connection
      values - the values
      Throws:
      SQLException - if an error occurs
    • create

      public <RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH create(Connection connection, T value, RH keyConsumer) throws SQLException
      Description copied from interface: Crud
      insert value into the db through the specified connection. Callback keyConsumer with the generated key if one was.
      Specified by:
      create in interface Crud<T,K>
      Type Parameters:
      RH - the type of keyConsumer
      Parameters:
      connection - the connection
      value - the value
      keyConsumer - the key consumer
      Returns:
      the keyConsumer
      Throws:
      SQLException
    • create

      public <RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH create(Connection connection, Collection<T> values, RH keyConsumer) throws SQLException
      Description copied from interface: Crud
      insert values into the db through the specified connection. Callback keyConsumer for the generated keys.
      Specified by:
      create in interface Crud<T,K>
      Type Parameters:
      RH - the type of keyConsumer
      Parameters:
      connection - the connection
      values - the values
      keyConsumer - the key consumer
      Returns:
      the keyConsumer
      Throws:
      SQLException
    • read

      public T read(Connection connection, K key) throws SQLException
      Description copied from interface: Crud
      retrieve the object with the specified key.
      Specified by:
      read in interface Crud<T,K>
      Parameters:
      connection - the connection
      key - the key
      Returns:
      the object or null if not found
      Throws:
      SQLException - if an error occurs
    • read

      public <RH extends org.simpleflatmapper.util.CheckedConsumer<? super T>> RH read(Connection connection, Collection<K> keys, RH consumer) throws SQLException
      Description copied from interface: Crud
      retrieve the objects with the specified keys and pass them to the consumer.
      Specified by:
      read in interface Crud<T,K>
      Parameters:
      connection - the connection
      keys - the keys
      consumer - the handler that is callback for each row
      Throws:
      SQLException - if an error occurs
    • update

      public void update(Connection connection, T value) throws SQLException
      Description copied from interface: Crud
      update the object.
      Specified by:
      update in interface Crud<T,K>
      Parameters:
      connection - the connection
      value - the object
      Throws:
      SQLException - if an error occurs
    • update

      public void update(Connection connection, Collection<T> values) throws SQLException
      Description copied from interface: Crud
      update the objects.
      Specified by:
      update in interface Crud<T,K>
      Parameters:
      connection - the connection
      values - the objects
      Throws:
      SQLException - if an error occurs
    • delete

      public void delete(Connection connection, K key) throws SQLException
      Description copied from interface: Crud
      delete the object with the specified key.
      Specified by:
      delete in interface Crud<T,K>
      Parameters:
      connection - the connection
      key - the key
      Throws:
      SQLException - if an error occurs
    • delete

      public void delete(Connection connection, Collection<K> keys) throws SQLException
      Description copied from interface: Crud
      delete the objects with the specified keys.
      Specified by:
      delete in interface Crud<T,K>
      Parameters:
      connection - the connection
      keys - the keys
      Throws:
      SQLException - if an error occurs
    • createOrUpdate

      public void createOrUpdate(Connection connection, T value) throws SQLException
      Description copied from interface: Crud
      UPSERT only supported on Mysql
      Specified by:
      createOrUpdate in interface Crud<T,K>
      Parameters:
      connection - the connection
      value - the value
      Throws:
      SQLException
    • createOrUpdate

      public void createOrUpdate(Connection connection, Collection<T> values) throws SQLException
      Description copied from interface: Crud
      UPSERT only supported on Mysql
      Specified by:
      createOrUpdate in interface Crud<T,K>
      Parameters:
      connection - the connection
      values - the values to upsert
      Throws:
      SQLException
    • createOrUpdate

      public <RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH createOrUpdate(Connection connection, T value, RH keyConsumer) throws SQLException
      Description copied from interface: Crud
      UPSERT only supported on Mysql and Postgres 9.5. Used the callback with caution has Mysql will return an incremented id event for when no insert actually occurred.
      Specified by:
      createOrUpdate in interface Crud<T,K>
      Type Parameters:
      RH - the keyConsumer type
      Parameters:
      connection - the connection
      value - the value to upsert
      keyConsumer - generated key consumer
      Returns:
      the keyConsumer
      Throws:
      SQLException
    • createOrUpdate

      public <RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH createOrUpdate(Connection connection, Collection<T> values, RH keyConsumer) throws SQLException
      Description copied from interface: Crud
      UPSERT only supported on Mysql and Postgres 9.5. Used the callback with caution has Mysql will return an incremented id event for when no insert actually occurred.
      Specified by:
      createOrUpdate in interface Crud<T,K>
      Type Parameters:
      RH - the keyConsumer type
      Parameters:
      connection - the connection
      values - the values to insert
      keyConsumer - generated key consumer
      Returns:
      the keyConsumer
      Throws:
      SQLException
    • where

      public <P> SelectQuery<T,P> where(String whereClause, Type paramClass)
      Specified by:
      where in interface Crud<T,K>