class BatchUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static boolean |
debugEnabled
So we don't always have to call logSql.debug()
|
private static boolean |
isInitialised |
private static org.slf4j.Logger |
logSql
Log all SQL statements.
|
private static java.util.Map<java.lang.String,java.util.List<BatchedPropertyInfo>> |
propertyDeleteOrders
Mapping classes/entity names to property update orders.
|
private static java.util.Map<java.lang.String,java.util.List<BatchedPropertyInfo>> |
propertyInsertOrders
Mapping classes/entity names to property insert orders.
|
private static java.util.Map<java.lang.String,java.util.List<BatchedPropertyInfo>> |
propertyUpdateOrders
Mapping classes/entity names to property delete orders.
|
private static java.util.Map<java.lang.String,java.lang.String> |
sqlDeletes
Mapping classes/entity names to SQL deletes.
|
private static java.util.Map<java.lang.String,java.lang.String> |
sqlInserts
Mapping classes/entity names to SQL inserts.
|
private static java.util.Map<java.lang.String,java.lang.String> |
sqlUpdates
Mapping classes/entity names to SQL updates.
|
Constructor and Description |
---|
BatchUtil() |
Modifier and Type | Method and Description |
---|---|
private static void |
buildDelete(java.lang.String entityName,
Dialect dialect)
Build delete SQL string and put it in the SQL map.
|
private static void |
buildInsert(java.lang.String entityName,
Dialect dialect)
Build insert SQL string and put it in the SQL map.
|
(package private) static java.lang.String |
buildInsertSelectSql(VirtualDb vdb,
VirtualTable table,
VirtualColumn[] columns,
java.lang.String selectSql) |
(package private) static java.lang.String |
buildInsertSql(VirtualDb vdb,
VirtualTable table,
VirtualColumn[] columns,
java.lang.Object[] values) |
private static void |
buildUpdate(java.lang.String entityName,
Dialect dialect)
Build update SQL string and put it in the SQL map.
|
(package private) static java.util.List<BatchedPropertyInfo> |
getDeletePropertyOrder(java.lang.Class<? extends BatchableData> dataClass)
Get the order of properties in the delete SQL.
|
(package private) static java.util.List<BatchedPropertyInfo> |
getDeletePropertyOrder(java.lang.String entityName)
Get the order of properties in the delete SQL.
|
(package private) static java.lang.String |
getDeleteSql(java.lang.Class<? extends BatchableData> dataClass)
Get the SQL that deletes a new row of the specified class.
|
(package private) static java.lang.String |
getDeleteSql(java.lang.String entityName)
Get the SQL that deletes a new row of the specified class.
|
(package private) static java.util.List<BatchedPropertyInfo> |
getInsertPropertyOrder(java.lang.Class<? extends BatchableData> dataClass)
Get the order of properties in the insert SQL.
|
(package private) static java.util.List<BatchedPropertyInfo> |
getInsertPropertyOrder(java.lang.String entityName)
Get the order of properties in the insert SQL.
|
(package private) static java.lang.String |
getInsertSql(java.lang.Class<? extends BatchableData> dataClass)
Get the SQL that inserts a new row of the specified class.
|
(package private) static java.lang.String |
getInsertSql(java.lang.String entityName)
Get the SQL that inserts a new row of the specified class.
|
(package private) static java.util.List<BatchedPropertyInfo> |
getUpdatePropertyOrder(java.lang.Class<? extends BatchableData> dataClass)
Get the order of properties in the update SQL.
|
(package private) static java.util.List<BatchedPropertyInfo> |
getUpdatePropertyOrder(java.lang.String entityName)
Get the order of properties in the update SQL.
|
(package private) static java.lang.String |
getUpdateSql(java.lang.Class<? extends BatchableData> dataClass)
Get the SQL that updates a new row of the specified class.
|
(package private) static java.lang.String |
getUpdateSql(java.lang.String entityName)
Get the SQL that updates a new row of the specified class.
|
(package private) static void |
init()
Generate SQL for all BatchableData classes for insert,
update and delete operations.
|
(package private) static void |
unload()
Unload all settings.
|
private static final org.slf4j.Logger logSql
private static final boolean debugEnabled
private static java.util.Map<java.lang.String,java.util.List<BatchedPropertyInfo>> propertyInsertOrders
private static java.util.Map<java.lang.String,java.util.List<BatchedPropertyInfo>> propertyUpdateOrders
private static java.util.Map<java.lang.String,java.util.List<BatchedPropertyInfo>> propertyDeleteOrders
private static java.util.Map<java.lang.String,java.lang.String> sqlInserts
private static java.util.Map<java.lang.String,java.lang.String> sqlUpdates
private static java.util.Map<java.lang.String,java.lang.String> sqlDeletes
private static boolean isInitialised
static void init()
static void unload()
static java.lang.String getInsertSql(java.lang.Class<? extends BatchableData> dataClass)
dataClass
- Get the insert SQL for this classstatic java.lang.String getInsertSql(java.lang.String entityName)
entityName
- The entity namestatic java.lang.String getUpdateSql(java.lang.Class<? extends BatchableData> dataClass)
dataClass
- Get the update SQL for this classstatic java.lang.String getUpdateSql(java.lang.String entityName)
entityName
- The entity namestatic java.lang.String getDeleteSql(java.lang.Class<? extends BatchableData> dataClass)
dataClass
- Get the delete SQL for this classstatic java.lang.String getDeleteSql(java.lang.String entityName)
entityName
- The entity namestatic java.util.List<BatchedPropertyInfo> getInsertPropertyOrder(java.lang.Class<? extends BatchableData> dataClass)
dataClass
- Get the property order for this classstatic java.util.List<BatchedPropertyInfo> getInsertPropertyOrder(java.lang.String entityName)
entityName
- The entity namestatic java.util.List<BatchedPropertyInfo> getUpdatePropertyOrder(java.lang.Class<? extends BatchableData> dataClass)
dataClass
- Get the property order for this class.static java.util.List<BatchedPropertyInfo> getUpdatePropertyOrder(java.lang.String entityName)
entityName
- The entity namestatic java.util.List<BatchedPropertyInfo> getDeletePropertyOrder(java.lang.Class<? extends BatchableData> dataClass)
dataClass
- Get the property order for this class.static java.util.List<BatchedPropertyInfo> getDeletePropertyOrder(java.lang.String entityName)
entityName
- The entity namestatic java.lang.String buildInsertSql(VirtualDb vdb, VirtualTable table, VirtualColumn[] columns, java.lang.Object[] values)
static java.lang.String buildInsertSelectSql(VirtualDb vdb, VirtualTable table, VirtualColumn[] columns, java.lang.String selectSql)
private static void buildInsert(java.lang.String entityName, Dialect dialect)
entityName
- The name of the class to generate the SQL for,
the name is usually the same as the class name, but doesn't have to bedialect
- The database dialect in useprivate static void buildUpdate(java.lang.String entityName, Dialect dialect)
entityName
- The name of the class to generate the SQL for,
the name is usually the same as the class name, but doesn't have to bedialect
- The database dialect in useprivate static void buildDelete(java.lang.String entityName, Dialect dialect)
entityName
- The name of the class to generate the SQL for,
the name is usually the same as the class name, but doesn't have to bedialect
- The database dialect in use