public final class BetterSqlMapper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
BetterSqlMapper.SelectBuilder<T> |
| Modifier and Type | Method and Description |
|---|---|
int |
delete(java.sql.Connection connection,
java.util.Collection<?> keys,
java.lang.Class<?> clazz)
Bulk delete entities with matching primary keys.
|
void |
delete(java.sql.Connection connection,
java.lang.Object entity)
Delete entity.
|
int |
delete(java.sql.Connection connection,
java.lang.Object key,
java.lang.Class<?> clazz)
Delete entity with matching primary key.
|
<T> java.util.List<T> |
find(java.sql.Connection connection,
java.util.Collection<?> keys,
java.lang.Class<T> clazz)
Find entities with matching primary keys
|
<T> T |
find(java.sql.Connection connection,
java.lang.Object key,
java.lang.Class<T> clazz)
Find entity with matching primary key
|
static BetterSqlMapper |
from(BetterOptions options) |
static BetterSqlMapper |
fromDefaults() |
<T> T |
insert(java.sql.Connection connection,
T entity)
Insert entity.
|
<T> BetterSqlMapper.SelectBuilder<T> |
select(java.lang.String sql,
java.lang.Class<T> clazz)
Create a Select Builder.
|
void |
update(java.sql.Connection connection,
java.lang.Object entity)
Update entity.
|
public static BetterSqlMapper fromDefaults()
public static BetterSqlMapper from(BetterOptions options)
public <T> T find(java.sql.Connection connection,
java.lang.Object key,
java.lang.Class<T> clazz)
T - entity typeconnection - db connection. close it yourselfkey - primary key to filter onclazz - entity type classpublic <T> java.util.List<T> find(java.sql.Connection connection,
java.util.Collection<?> keys,
java.lang.Class<T> clazz)
T - entity typeconnection - db connection. close it yourselfkeys - primary keys to filter onclazz - entity type classpublic <T> T insert(java.sql.Connection connection,
T entity)
for auto-generated keys, the primary key has to be null in the entity. if the primary key is non-null, the insert will be formatted to insert with that specified primary key.
dorm will extract the generated key and return it in a copied entity object. this can return a null object if it fails to get the generated key for some reason. if the primary key is non-null, the insert will simply return itself.
T - entity typeconnection - db connection. close it yourselfentity - entity to insertpublic void update(java.sql.Connection connection,
java.lang.Object entity)
connection - db connection. close it yourselfentity - entity to updatepublic void delete(java.sql.Connection connection,
java.lang.Object entity)
connection - db connection. close it yourselfentity - entity to deletepublic int delete(java.sql.Connection connection,
java.lang.Object key,
java.lang.Class<?> clazz)
connection - db connection. close it yourselfkey - primary key to filter onclazz - entity type classpublic int delete(java.sql.Connection connection,
java.util.Collection<?> keys,
java.lang.Class<?> clazz)
connection - db connection. close it yourselfkeys - primary keys to filter onclazz - entity type classpublic <T> BetterSqlMapper.SelectBuilder<T> select(java.lang.String sql, java.lang.Class<T> clazz)
T - entity typesql - select statementclazz - entity type class