T - the target typeK - the key typepublic class ConnectedCrud<T,K> extends Object
| Constructor and Description |
|---|
ConnectedCrud(TransactionTemplate transactionTemplate,
Crud<T,K> delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
create(Collection<T> values)
insert values into the db through the specified connection.
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> |
create(Collection<T> values,
RH keyConsumer)
insert values into the db through the specified connection.
|
void |
create(T value)
insert value into the db through the specified connection.
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> |
create(T value,
RH keyConsumer)
insert value into the db through the specified connection.
|
void |
createOrUpdate(Collection<T> values)
UPSERT only supported on Mysql
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> |
createOrUpdate(Collection<T> values,
RH keyConsumer)
UPSERT only supported on Mysql and Postgres 9.5.
|
void |
createOrUpdate(T value)
UPSERT only supported on Mysql
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> |
createOrUpdate(T value,
RH keyConsumer)
UPSERT only supported on Mysql and Postgres 9.5.
|
Crud<T,K> |
crud() |
void |
delete(Collection<K> keys)
delete the objects with the specified keys.
|
void |
delete(K key)
delete the object with the specified key.
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super T>> |
read(Collection<K> keys,
RH consumer)
retrieve the objects with the specified keys and pass them to the consumer.
|
T |
read(K key)
retrieve the object with the specified key.
|
void |
update(Collection<T> values)
update the objects.
|
void |
update(T value)
update the object.
|
<P> ConnectedSelectQuery<T,P> |
where(String whereClause,
Type paramClass) |
public ConnectedCrud(TransactionTemplate transactionTemplate, Crud<T,K> delegate)
public void create(T value) throws SQLException
value - the valueSQLException - if an error occurspublic void create(Collection<T> values) throws SQLException
values - the valuesSQLException - if an error occurspublic <RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH create(T value, RH keyConsumer) throws SQLException
RH - the type of keyConsumervalue - the valuekeyConsumer - the key consumerSQLExceptionpublic <RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH create(Collection<T> values, RH keyConsumer) throws SQLException
RH - the type of keyConsumervalues - the valueskeyConsumer - the key consumerSQLExceptionpublic T read(K key) throws SQLException
key - the keySQLException - if an error occurspublic <RH extends org.simpleflatmapper.util.CheckedConsumer<? super T>> RH read(Collection<K> keys, RH consumer) throws SQLException
keys - the keysconsumer - the handler that is callback for each rowSQLException - if an error occurspublic void update(T value) throws SQLException
value - the objectSQLException - if an error occurspublic void update(Collection<T> values) throws SQLException
values - the objectsSQLException - if an error occurspublic void delete(K key) throws SQLException
key - the keySQLException - if an error occurspublic void delete(Collection<K> keys) throws SQLException
keys - the keysSQLException - if an error occurspublic void createOrUpdate(T value) throws SQLException
value - the valueSQLExceptionUnsupportedOperationExceptionpublic void createOrUpdate(Collection<T> values) throws SQLException
values - the values to upsertSQLExceptionUnsupportedOperationExceptionpublic <RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH createOrUpdate(T value, RH keyConsumer) throws SQLException
RH - the keyConsumer typevalue - the value to upsertkeyConsumer - generated key consumerSQLExceptionpublic <RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH createOrUpdate(Collection<T> values, RH keyConsumer) throws SQLException
RH - the keyConsumer typevalues - the values to insertkeyConsumer - generated key consumerSQLExceptionpublic <P> ConnectedSelectQuery<T,P> where(String whereClause, Type paramClass)
Copyright © 2020. All rights reserved.