public abstract class MySQLBaseDAO
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected javax.sql.DataSource |
dataSource |
protected org.slf4j.Logger |
logger |
protected com.fasterxml.jackson.databind.ObjectMapper |
objectMapper |
| Modifier | Constructor and Description |
|---|---|
protected |
MySQLBaseDAO(com.fasterxml.jackson.databind.ObjectMapper om,
javax.sql.DataSource dataSource) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
execute(java.sql.Connection tx,
java.lang.String query,
ExecuteFunction function)
Execute a statement with no expected return value within a given transaction.
|
protected void |
executeWithTransaction(java.lang.String query,
ExecuteFunction function)
Instantiates a new transactional connection and invokes
execute(Connection, String, ExecuteFunction) |
protected com.netflix.conductor.dao.mysql.LazyToString |
getCallingMethod() |
protected <R> R |
getWithTransactionWithOutErrorPropagation(TransactionalFunction<R> function) |
protected <R> R |
query(java.sql.Connection tx,
java.lang.String query,
QueryFunction<R> function)
Execute a
Query within the context of a given transaction and return the results of function. |
protected <R> R |
queryWithTransaction(java.lang.String query,
QueryFunction<R> function)
Initiate a new transaction and execute a
Query within that context,
then return the results of function. |
protected <T> T |
readValue(java.lang.String json,
java.lang.Class<T> tClass) |
protected <T> T |
readValue(java.lang.String json,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
protected java.lang.String |
toJson(java.lang.Object value) |
protected void |
withTransaction(java.util.function.Consumer<java.sql.Connection> consumer)
Wraps
getWithRetriedTransactions(TransactionalFunction) with no return value. |
protected final org.slf4j.Logger logger
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
protected final javax.sql.DataSource dataSource
protected MySQLBaseDAO(com.fasterxml.jackson.databind.ObjectMapper om,
javax.sql.DataSource dataSource)
protected final com.netflix.conductor.dao.mysql.LazyToString getCallingMethod()
protected java.lang.String toJson(java.lang.Object value)
protected <T> T readValue(java.lang.String json,
java.lang.Class<T> tClass)
protected <T> T readValue(java.lang.String json,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
protected <R> R getWithTransactionWithOutErrorPropagation(TransactionalFunction<R> function)
protected void withTransaction(java.util.function.Consumer<java.sql.Connection> consumer)
getWithRetriedTransactions(TransactionalFunction) with no return value.
Generally this is used to wrap multiple execute(Connection, String, ExecuteFunction) or
query(Connection, String, QueryFunction) invocations that produce no expected return value.
consumer - The Consumer callback to pass a transactional Connection to.com.netflix.conductor.core.execution.ApplicationException - If any errors occur.getWithRetriedTransactions(TransactionalFunction)protected <R> R queryWithTransaction(java.lang.String query,
QueryFunction<R> function)
Query within that context,
then return the results of function.R - The expected return type of function.query - The query string to prepare.function - The functional callback to pass a Query to.protected <R> R query(java.sql.Connection tx,
java.lang.String query,
QueryFunction<R> function)
Query within the context of a given transaction and return the results of function.R - The expected return type of function.tx - The transactional Connection to use.query - The query string to prepare.function - The functional callback to pass a Query to.protected void execute(java.sql.Connection tx,
java.lang.String query,
ExecuteFunction function)
tx - The transactional Connection to use.query - The query string to prepare.function - The functional callback to pass a Query to.protected void executeWithTransaction(java.lang.String query,
ExecuteFunction function)
execute(Connection, String, ExecuteFunction)query - The query string to prepare.function - The functional callback to pass a Query to.