T
- the target typeK
- the key typepublic interface Crud<T,K>
Modifier and Type | Method and Description |
---|---|
void |
create(Connection connection,
Collection<T> values)
insert values into the db through the specified connection.
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> |
create(Connection connection,
Collection<T> values,
RH keyConsumer)
insert values into the db through the specified connection.
|
void |
create(Connection connection,
T value)
insert value into the db through the specified connection.
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> |
create(Connection connection,
T value,
RH keyConsumer)
insert value into the db through the specified connection.
|
void |
createOrUpdate(Connection connection,
Collection<T> values)
UPSERT only supported on Mysql
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> |
createOrUpdate(Connection connection,
Collection<T> values,
RH keyConsumer)
UPSERT only supported on Mysql and Postgres 9.5.
|
void |
createOrUpdate(Connection connection,
T value)
UPSERT only supported on Mysql
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> |
createOrUpdate(Connection connection,
T value,
RH keyConsumer)
UPSERT only supported on Mysql and Postgres 9.5.
|
void |
delete(Connection connection,
Collection<K> keys)
delete the objects with the specified keys.
|
void |
delete(Connection connection,
K key)
delete the object with the specified key.
|
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super T>> |
read(Connection connection,
Collection<K> keys,
RH consumer)
retrieve the objects with the specified keys and pass them to the consumer.
|
T |
read(Connection connection,
K key)
retrieve the object with the specified key.
|
void |
update(Connection connection,
Collection<T> values)
update the objects.
|
void |
update(Connection connection,
T value)
update the object.
|
<P> SelectQuery<T,P> |
where(String whereClause,
Type paramClass) |
void create(Connection connection, T value) throws SQLException
connection
- the connectionvalue
- the valueSQLException
- if an error occursvoid create(Connection connection, Collection<T> values) throws SQLException
connection
- the connectionvalues
- the valuesSQLException
- if an error occurs<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH create(Connection connection, T value, RH keyConsumer) throws SQLException
RH
- the type of keyConsumerconnection
- the connectionvalue
- the valuekeyConsumer
- the key consumerSQLException
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH create(Connection connection, Collection<T> values, RH keyConsumer) throws SQLException
RH
- the type of keyConsumerconnection
- the connectionvalues
- the valueskeyConsumer
- the key consumerSQLException
T read(Connection connection, K key) throws SQLException
connection
- the connectionkey
- the keySQLException
- if an error occurs<RH extends org.simpleflatmapper.util.CheckedConsumer<? super T>> RH read(Connection connection, Collection<K> keys, RH consumer) throws SQLException
connection
- the connectionkeys
- the keysconsumer
- the handler that is callback for each rowSQLException
- if an error occursvoid update(Connection connection, T value) throws SQLException
connection
- the connectionvalue
- the objectSQLException
- if an error occursvoid update(Connection connection, Collection<T> values) throws SQLException
connection
- the connectionvalues
- the objectsSQLException
- if an error occursvoid delete(Connection connection, K key) throws SQLException
connection
- the connectionkey
- the keySQLException
- if an error occursvoid delete(Connection connection, Collection<K> keys) throws SQLException
connection
- the connectionkeys
- the keysSQLException
- if an error occursvoid createOrUpdate(Connection connection, T value) throws SQLException
connection
- the connectionvalue
- the valueSQLException
UnsupportedOperationException
void createOrUpdate(Connection connection, Collection<T> values) throws SQLException
connection
- the connectionvalues
- the values to upsertSQLException
UnsupportedOperationException
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH createOrUpdate(Connection connection, T value, RH keyConsumer) throws SQLException
RH
- the keyConsumer typeconnection
- the connectionvalue
- the value to upsertkeyConsumer
- generated key consumerSQLException
<RH extends org.simpleflatmapper.util.CheckedConsumer<? super K>> RH createOrUpdate(Connection connection, Collection<T> values, RH keyConsumer) throws SQLException
RH
- the keyConsumer typeconnection
- the connectionvalues
- the values to insertkeyConsumer
- generated key consumerSQLException
<P> SelectQuery<T,P> where(String whereClause, Type paramClass)
Copyright © 2018. All rights reserved.