Module org.simpleflatmapper.jdbc
Package org.simpleflatmapper.jdbc.impl
Class MultiRowsBatchInsertCrud<T,K>
java.lang.Object
org.simpleflatmapper.jdbc.impl.MultiRowsBatchInsertCrud<T,K>
- All Implemented Interfaces:
Crud<T,K>
-
Constructor Summary
ConstructorsConstructorDescriptionMultiRowsBatchInsertCrud(DefaultCrud<T, K> delegate, BatchQueryExecutor<T> batchInsertQueryPreparer, BatchQueryExecutor<T> batchUpsertQueryExecutor) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate(Connection connection, Collection<T> values) insert values into the db through the specified connection.<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>>
RHcreate(Connection connection, Collection<T> values, RH keyConsumer) insert values into the db through the specified connection.voidcreate(Connection connection, T value) insert value into the db through the specified connection.<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>>
RHcreate(Connection connection, T value, RH keyConsumer) insert value into the db through the specified connection.voidcreateOrUpdate(Connection connection, Collection<T> values) UPSERT only supported on Mysql<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>>
RHcreateOrUpdate(Connection connection, Collection<T> values, RH keyConsumer) UPSERT only supported on Mysql and Postgres 9.5.voidcreateOrUpdate(Connection connection, T value) UPSERT only supported on Mysql<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>>
RHcreateOrUpdate(Connection connection, T value, RH keyConsumer) UPSERT only supported on Mysql and Postgres 9.5.voiddelete(Connection connection, Collection<K> keys) delete the objects with the specified keys.voiddelete(Connection connection, K key) delete the object with the specified key.<RH extends org.simpleflatmapper.util.CheckedConsumer<? super T>>
RHread(Connection connection, Collection<K> keys, RH consumer) retrieve the objects with the specified keys and pass them to the consumer.read(Connection connection, K key) retrieve the object with the specified key.voidupdate(Connection connection, Collection<T> values) update the objects.voidupdate(Connection connection, T value) update the object.<P> SelectQuery<T,P>
-
Constructor Details
-
MultiRowsBatchInsertCrud
public MultiRowsBatchInsertCrud(DefaultCrud<T, K> delegate, BatchQueryExecutor<T> batchInsertQueryPreparer, BatchQueryExecutor<T> batchUpsertQueryExecutor)
-
-
Method Details
-
create
Description copied from interface:Crudinsert value into the db through the specified connection.- Specified by:
createin interfaceCrud<T,K> - Parameters:
connection- the connectionvalue- the value- Throws:
SQLException- if an error occurs
-
create
Description copied from interface:Crudinsert values into the db through the specified connection.- Specified by:
createin interfaceCrud<T,K> - Parameters:
connection- the connectionvalues- 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:Crudinsert value into the db through the specified connection. Callback keyConsumer with the generated key if one was.- Specified by:
createin interfaceCrud<T,K> - Type Parameters:
RH- the type of keyConsumer- Parameters:
connection- the connectionvalue- the valuekeyConsumer- 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:Crudinsert values into the db through the specified connection. Callback keyConsumer for the generated keys.- Specified by:
createin interfaceCrud<T,K> - Type Parameters:
RH- the type of keyConsumer- Parameters:
connection- the connectionvalues- the valueskeyConsumer- the key consumer- Returns:
- the keyConsumer
- Throws:
SQLException
-
read
Description copied from interface:Crudretrieve the object with the specified key.- Specified by:
readin interfaceCrud<T,K> - Parameters:
connection- the connectionkey- 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:Crudretrieve the objects with the specified keys and pass them to the consumer.- Specified by:
readin interfaceCrud<T,K> - Parameters:
connection- the connectionkeys- the keysconsumer- the handler that is callback for each row- Throws:
SQLException- if an error occurs
-
update
Description copied from interface:Crudupdate the object.- Specified by:
updatein interfaceCrud<T,K> - Parameters:
connection- the connectionvalue- the object- Throws:
SQLException- if an error occurs
-
update
Description copied from interface:Crudupdate the objects.- Specified by:
updatein interfaceCrud<T,K> - Parameters:
connection- the connectionvalues- the objects- Throws:
SQLException- if an error occurs
-
delete
Description copied from interface:Cruddelete the object with the specified key.- Specified by:
deletein interfaceCrud<T,K> - Parameters:
connection- the connectionkey- the key- Throws:
SQLException- if an error occurs
-
delete
Description copied from interface:Cruddelete the objects with the specified keys.- Specified by:
deletein interfaceCrud<T,K> - Parameters:
connection- the connectionkeys- the keys- Throws:
SQLException- if an error occurs
-
createOrUpdate
Description copied from interface:CrudUPSERT only supported on Mysql- Specified by:
createOrUpdatein interfaceCrud<T,K> - Parameters:
connection- the connectionvalue- the value- Throws:
SQLException
-
createOrUpdate
Description copied from interface:CrudUPSERT only supported on Mysql- Specified by:
createOrUpdatein interfaceCrud<T,K> - Parameters:
connection- the connectionvalues- 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:CrudUPSERT 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:
createOrUpdatein interfaceCrud<T,K> - Type Parameters:
RH- the keyConsumer type- Parameters:
connection- the connectionvalue- the value to upsertkeyConsumer- 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:CrudUPSERT 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:
createOrUpdatein interfaceCrud<T,K> - Type Parameters:
RH- the keyConsumer type- Parameters:
connection- the connectionvalues- the values to insertkeyConsumer- generated key consumer- Returns:
- the keyConsumer
- Throws:
SQLException
-
where
-