public interface SqlQuery
An abstraction for 99% of the database operations I've done over the years.
Type Params | Return Type | Name and description |
---|---|---|
|
public SqlQuery |
bind(java.lang.Object bean) Set the parameters of the query from the properties of the Bean. |
|
public void |
executeUpdate() Execute an update query (insert, update, delete). |
|
public java.util.Map<java.lang.String, java.lang.Object> |
findRow()
|
<T> |
public T |
findRow(java.lang.Class<T> type) Execute a query and map it to a Java Bean. |
|
public java.util.List<java.util.Map<java.lang.String, java.lang.Object>> |
findRows()
|
<T> |
public java.util.List<T> |
findRows(java.lang.Class<T> type) Execute a query and return a list of Beans of type T |
<T extends Serializable> |
public T |
findScalar(java.lang.Class<T> type) Execute a query that returns a single scalar value, such as a VARCHAR column or the result of a count() |
<T extends Serializable> |
public java.util.List<T> |
findScalarList(java.lang.Class<T> type) Execute a query that returns a List of scalar values, such as a list of VARCHAR rows |
|
public SqlQuery |
params(java.util.Map<java.lang.String, java.lang.Object> namedParams) Set the parameters of this query from a Map |
|
public SqlQuery |
params(java.lang.Object positionalParams) Set the parameters of this query using positional arguments |
|
public SqlQuery |
setFirstRow(int firstRow) |
|
public SqlQuery |
setMaxRows(int maxRows) |
Set the parameters of the query from the properties of the Bean.
bean
- A regular Java BeanExecute an update query (insert, update, delete).
Execute a query and map it to a Java Bean. The bean must have a default no-args constructor.
type
- The class of the Java beanT
- The type of bean to return
Execute a query and return a list of Beans of type T
type
- The class of the Java beanT
- The type of bean to returnExecute a query that returns a single scalar value, such as a VARCHAR column or the result of a count()
type
- The scalar typeT
- A Serializable class such as String, Integer or LongExecute a query that returns a List of scalar values, such as a list of VARCHAR rows
type
- The scalar typeT
- A Serializable class such as String, Integer or LongSet the parameters of this query from a Map
namedParams
- a Map of parametersSet the parameters of this query using positional arguments
positionalParams
- A list of parameters