class BatchUtil extends 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 Map<String,List<BatchedPropertyInfo>> |
propertyDeleteOrders
Mapping classes/entity names to property update orders.
|
private static Map<String,List<BatchedPropertyInfo>> |
propertyInsertOrders
Mapping classes/entity names to property insert orders.
|
private static Map<String,List<BatchedPropertyInfo>> |
propertyUpdateOrders
Mapping classes/entity names to property delete orders.
|
private static Map<String,String> |
sqlDeletes
Mapping classes/entity names to SQL deletes.
|
private static Map<String,String> |
sqlInserts
Mapping classes/entity names to SQL inserts.
|
private static Map<String,String> |
sqlUpdates
Mapping classes/entity names to SQL updates.
|
Constructor and Description |
---|
BatchUtil() |
Modifier and Type | Method and Description |
---|---|
private static void |
buildDelete(String entityName,
Dialect dialect)
Build delete SQL string and put it in the SQL map.
|
private static void |
buildInsert(String entityName,
Dialect dialect)
Build insert SQL string and put it in the SQL map.
|
(package private) static String |
buildInsertSelectSql(VirtualDb vdb,
VirtualTable table,
VirtualColumn[] columns,
String selectSql) |
(package private) static String |
buildInsertSql(VirtualDb vdb,
VirtualTable table,
VirtualColumn[] columns,
Object[] values) |
private static void |
buildUpdate(String entityName,
Dialect dialect)
Build update SQL string and put it in the SQL map.
|
(package private) static List<BatchedPropertyInfo> |
getDeletePropertyOrder(Class<? extends BatchableData> dataClass)
Get the order of properties in the delete SQL.
|
(package private) static List<BatchedPropertyInfo> |
getDeletePropertyOrder(String entityName)
Get the order of properties in the delete SQL.
|
(package private) static String |
getDeleteSql(Class<? extends BatchableData> dataClass)
Get the SQL that deletes a new row of the specified class.
|
(package private) static String |
getDeleteSql(String entityName)
Get the SQL that deletes a new row of the specified class.
|
(package private) static List<BatchedPropertyInfo> |
getInsertPropertyOrder(Class<? extends BatchableData> dataClass)
Get the order of properties in the insert SQL.
|
(package private) static List<BatchedPropertyInfo> |
getInsertPropertyOrder(String entityName)
Get the order of properties in the insert SQL.
|
(package private) static String |
getInsertSql(Class<? extends BatchableData> dataClass)
Get the SQL that inserts a new row of the specified class.
|
(package private) static String |
getInsertSql(String entityName)
Get the SQL that inserts a new row of the specified class.
|
(package private) static List<BatchedPropertyInfo> |
getUpdatePropertyOrder(Class<? extends BatchableData> dataClass)
Get the order of properties in the update SQL.
|
(package private) static List<BatchedPropertyInfo> |
getUpdatePropertyOrder(String entityName)
Get the order of properties in the update SQL.
|
(package private) static String |
getUpdateSql(Class<? extends BatchableData> dataClass)
Get the SQL that updates a new row of the specified class.
|
(package private) static String |
getUpdateSql(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 Map<String,List<BatchedPropertyInfo>> propertyInsertOrders
private static Map<String,List<BatchedPropertyInfo>> propertyUpdateOrders
private static Map<String,List<BatchedPropertyInfo>> propertyDeleteOrders
private static Map<String,String> sqlInserts
private static Map<String,String> sqlUpdates
private static Map<String,String> sqlDeletes
private static boolean isInitialised
static void init()
static void unload()
static String getInsertSql(Class<? extends BatchableData> dataClass)
dataClass
- Get the insert SQL for this classstatic String getInsertSql(String entityName)
entityName
- The entity namestatic String getUpdateSql(Class<? extends BatchableData> dataClass)
dataClass
- Get the update SQL for this classstatic String getUpdateSql(String entityName)
entityName
- The entity namestatic String getDeleteSql(Class<? extends BatchableData> dataClass)
dataClass
- Get the delete SQL for this classstatic String getDeleteSql(String entityName)
entityName
- The entity namestatic List<BatchedPropertyInfo> getInsertPropertyOrder(Class<? extends BatchableData> dataClass)
dataClass
- Get the property order for this classstatic List<BatchedPropertyInfo> getInsertPropertyOrder(String entityName)
entityName
- The entity namestatic List<BatchedPropertyInfo> getUpdatePropertyOrder(Class<? extends BatchableData> dataClass)
dataClass
- Get the property order for this class.static List<BatchedPropertyInfo> getUpdatePropertyOrder(String entityName)
entityName
- The entity namestatic List<BatchedPropertyInfo> getDeletePropertyOrder(Class<? extends BatchableData> dataClass)
dataClass
- Get the property order for this class.static List<BatchedPropertyInfo> getDeletePropertyOrder(String entityName)
entityName
- The entity namestatic String buildInsertSql(VirtualDb vdb, VirtualTable table, VirtualColumn[] columns, Object[] values)
static String buildInsertSelectSql(VirtualDb vdb, VirtualTable table, VirtualColumn[] columns, String selectSql)
private static void buildInsert(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(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(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