Package org.apache.ofbiz.entity.jdbc
Class SqlJdbcUtil
java.lang.Object
org.apache.ofbiz.entity.jdbc.SqlJdbcUtil
GenericDAO Utility methods for general tasks
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addValue
(StringBuffer buffer, ModelField field, Object value, List<EntityConditionParam> params) static void
addValue
(StringBuilder buffer, ModelField field, Object value, List<EntityConditionParam> params) static void
addValueSingle
(StringBuffer buffer, ModelField field, Object value, List<EntityConditionParam> params) static void
addValueSingle
(StringBuilder buffer, ModelField field, Object value, List<EntityConditionParam> params) static String
filterColName
(String colName) static int
static void
getValue
(ResultSet rs, int ind, ModelField curField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) static String
makeFromClause
(ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader, Datasource datasourceInfo) Makes the FROM clause and when necessary the JOIN clause(s) as wellstatic String
makeOrderByClause
(ModelEntity modelEntity, List<String> orderBy, boolean includeTablenamePrefix, Datasource datasourceInfo) static String
makeOrderByClause
(ModelEntity modelEntity, List<String> orderBy, Datasource datasourceInfo) static String
makeViewTable
(ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader, Datasource datasourceInfo) static String
makeViewWhereClause
(ModelEntity modelEntity, String joinStyle) static String
makeWhereClause
(ModelEntity modelEntity, List<ModelField> modelFields, Map<String, Object> fields, String operator, String joinStyle) static StringBuilder
makeWhereStringFromFields
(StringBuilder sb, List<ModelField> modelFields, Map<String, Object> fields, String operator) static StringBuilder
makeWhereStringFromFields
(StringBuilder sb, List<ModelField> modelFields, Map<String, Object> fields, String operator, List<EntityConditionParam> entityConditionParams) Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separatedstatic String
makeWhereStringFromFields
(List<ModelField> modelFields, Map<String, Object> fields, String operator) Deprecated.static String
makeWhereStringFromFields
(List<ModelField> modelFields, Map<String, Object> fields, String operator, List<EntityConditionParam> entityConditionParams) Deprecated.static void
setPkValues
(SQLProcessor sqlP, ModelEntity modelEntity, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) Get all primary keys from the model entity and bind their values to the an SQL statement (SQL-Processor)static <T> void
setValue
(SQLProcessor sqlP, ModelField modelField, String entityName, Object fieldValue, ModelFieldTypeReader modelFieldTypeReader) static void
setValue
(SQLProcessor sqlP, ModelField modelField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) static void
setValues
(SQLProcessor sqlP, List<ModelField> list, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) The elements (ModelFields) of the list are bound to an SQL statement (SQL-Processor)static void
setValuesWhereClause
(SQLProcessor sqlP, List<ModelField> list, GenericValue dummyValue, ModelFieldTypeReader modelFieldTypeReader) The elements (ModelFields) of the list are bound to an SQL statement (SQL-Processor), but values must not be null.
-
Method Details
-
makeFromClause
public static String makeFromClause(ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader, Datasource datasourceInfo) throws GenericEntityException Makes the FROM clause and when necessary the JOIN clause(s) as well- Throws:
GenericEntityException
-
makeWhereStringFromFields
@Deprecated public static String makeWhereStringFromFields(List<ModelField> modelFields, Map<String, Object> fields, String operator) Deprecated.Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separated -
makeWhereStringFromFields
public static StringBuilder makeWhereStringFromFields(StringBuilder sb, List<ModelField> modelFields, Map<String, Object> fields, String operator) -
makeWhereStringFromFields
@Deprecated public static String makeWhereStringFromFields(List<ModelField> modelFields, Map<String, Object> fields, String operator, List<EntityConditionParam> entityConditionParams) Deprecated.Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separated -
makeWhereStringFromFields
public static StringBuilder makeWhereStringFromFields(StringBuilder sb, List<ModelField> modelFields, Map<String, Object> fields, String operator, List<EntityConditionParam> entityConditionParams) Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separated -
makeWhereClause
public static String makeWhereClause(ModelEntity modelEntity, List<ModelField> modelFields, Map<String, Object> fields, String operator, String joinStyle) throws GenericEntityException- Throws:
GenericEntityException
-
makeViewWhereClause
public static String makeViewWhereClause(ModelEntity modelEntity, String joinStyle) throws GenericEntityException - Throws:
GenericEntityException
-
makeOrderByClause
public static String makeOrderByClause(ModelEntity modelEntity, List<String> orderBy, Datasource datasourceInfo) throws GenericModelException - Throws:
GenericModelException
-
makeOrderByClause
public static String makeOrderByClause(ModelEntity modelEntity, List<String> orderBy, boolean includeTablenamePrefix, Datasource datasourceInfo) throws GenericModelException - Throws:
GenericModelException
-
makeViewTable
public static String makeViewTable(ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader, Datasource datasourceInfo) throws GenericEntityException - Throws:
GenericEntityException
-
filterColName
-
setValues
public static void setValues(SQLProcessor sqlP, List<ModelField> list, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException The elements (ModelFields) of the list are bound to an SQL statement (SQL-Processor)- Parameters:
sqlP
-list
-entity
-- Throws:
GenericEntityException
-
setValuesWhereClause
public static void setValuesWhereClause(SQLProcessor sqlP, List<ModelField> list, GenericValue dummyValue, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException The elements (ModelFields) of the list are bound to an SQL statement (SQL-Processor), but values must not be null.- Parameters:
sqlP
-list
-dummyValue
-modelFieldTypeReader
-- Throws:
GenericEntityException
-
setPkValues
public static void setPkValues(SQLProcessor sqlP, ModelEntity modelEntity, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException Get all primary keys from the model entity and bind their values to the an SQL statement (SQL-Processor)- Parameters:
sqlP
-modelEntity
-entity
-modelFieldTypeReader
-- Throws:
GenericEntityException
-
getValue
public static void getValue(ResultSet rs, int ind, ModelField curField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException - Throws:
GenericEntityException
-
setValue
public static void setValue(SQLProcessor sqlP, ModelField modelField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException - Throws:
GenericEntityException
-
setValue
public static <T> void setValue(SQLProcessor sqlP, ModelField modelField, String entityName, Object fieldValue, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException - Throws:
GenericEntityException
-
getType
- Throws:
GenericNotImplementedException
-
addValueSingle
public static void addValueSingle(StringBuffer buffer, ModelField field, Object value, List<EntityConditionParam> params) -
addValueSingle
public static void addValueSingle(StringBuilder buffer, ModelField field, Object value, List<EntityConditionParam> params) -
addValue
public static void addValue(StringBuffer buffer, ModelField field, Object value, List<EntityConditionParam> params) -
addValue
public static void addValue(StringBuilder buffer, ModelField field, Object value, List<EntityConditionParam> params)
-