Search in sources :

Example 11 with ReflectPropsHandler

use of org.sagacity.sqltoy.callback.ReflectPropsHandler in project sagacity-sqltoy by chenrenfei.

the class ClickHouseDialectUtils method save.

/**
 * @todo 保存对象
 * @param sqlToyContext
 * @param entityMeta
 * @param insertSql
 * @param entity
 * @param conn
 * @param dbType
 * @return
 * @throws Exception
 */
public static Object save(SqlToyContext sqlToyContext, final EntityMeta entityMeta, final String insertSql, Serializable entity, final Connection conn, final Integer dbType) throws Exception {
    PKStrategy pkStrategy = entityMeta.getIdStrategy();
    ReturnPkType returnPkType = (pkStrategy != null && pkStrategy.equals(PKStrategy.SEQUENCE)) ? ReturnPkType.GENERATED_KEYS : ReturnPkType.PREPARD_ID;
    final boolean isIdentity = (pkStrategy != null && pkStrategy.equals(PKStrategy.IDENTITY));
    final boolean isSequence = (pkStrategy != null && pkStrategy.equals(PKStrategy.SEQUENCE));
    String[] reflectColumns;
    boolean isAssignPK = isAssignPKValue(pkStrategy);
    if ((isIdentity && !isAssignPK) || (isSequence && !isAssignPK)) {
        reflectColumns = entityMeta.getRejectIdFieldArray();
    } else {
        reflectColumns = entityMeta.getFieldsArray();
    }
    // 构造全新的新增记录参数赋值反射(覆盖之前的)
    ReflectPropsHandler handler = DialectUtils.getAddReflectHandler(null, sqlToyContext.getUnifyFieldsHandler());
    handler = DialectUtils.getSecureReflectHandler(handler, sqlToyContext.getFieldsSecureProvider(), sqlToyContext.getDesensitizeProvider(), entityMeta.getSecureFields());
    Object[] fullParamValues = BeanUtil.reflectBeanToAry(entity, reflectColumns, null, handler);
    boolean needUpdatePk = false;
    int pkIndex = entityMeta.getIdIndex();
    // 是否存在业务ID
    boolean hasBizId = (entityMeta.getBusinessIdGenerator() == null) ? false : true;
    int bizIdColIndex = hasBizId ? entityMeta.getFieldIndex(entityMeta.getBusinessIdField()) : 0;
    // 标识符
    String signature = entityMeta.getBizIdSignature();
    Integer[] relatedColumn = entityMeta.getBizIdRelatedColIndex();
    String[] relatedColumnNames = entityMeta.getBizIdRelatedColumns();
    int relatedColumnSize = (relatedColumn == null) ? 0 : relatedColumn.length;
    // 主键采用assign方式赋予,则调用generator产生id并赋予其值
    if (entityMeta.getIdStrategy() != null && null != entityMeta.getIdGenerator()) {
        int bizIdLength = entityMeta.getBizIdLength();
        int idLength = entityMeta.getIdLength();
        Object[] relatedColValue = null;
        String businessIdType = hasBizId ? entityMeta.getColumnJavaType(entityMeta.getBusinessIdField()) : "";
        if (relatedColumn != null) {
            relatedColValue = new Object[relatedColumnSize];
            for (int meter = 0; meter < relatedColumnSize; meter++) {
                relatedColValue[meter] = fullParamValues[relatedColumn[meter]];
                if (StringUtil.isBlank(relatedColValue[meter])) {
                    throw new IllegalArgumentException("对象:" + entityMeta.getEntityClass().getName() + " 生成业务主键依赖的关联字段:" + relatedColumnNames[meter] + " 值为null!");
                }
            }
        }
        if (StringUtil.isBlank(fullParamValues[pkIndex])) {
            // id通过generator机制产生,设置generator产生的值
            fullParamValues[pkIndex] = entityMeta.getIdGenerator().getId(entityMeta.getTableName(), signature, entityMeta.getBizIdRelatedColumns(), relatedColValue, null, entityMeta.getIdType(), idLength, entityMeta.getBizIdSequenceSize());
            needUpdatePk = true;
        }
        if (hasBizId && StringUtil.isBlank(fullParamValues[bizIdColIndex])) {
            fullParamValues[bizIdColIndex] = entityMeta.getBusinessIdGenerator().getId(entityMeta.getTableName(), signature, entityMeta.getBizIdRelatedColumns(), relatedColValue, null, businessIdType, bizIdLength, entityMeta.getBizIdSequenceSize());
            // 回写业务主键值
            BeanUtil.setProperty(entity, entityMeta.getBusinessIdField(), fullParamValues[bizIdColIndex]);
        }
    }
    SqlExecuteStat.showSql("执行单记录插入", insertSql, null);
    final Object[] paramValues = fullParamValues;
    final Integer[] paramsType = entityMeta.getFieldsTypeArray();
    PreparedStatement pst = null;
    Object result = SqlUtil.preparedStatementProcess(null, pst, null, new PreparedStatementResultHandler() {

        @Override
        public void execute(Object obj, PreparedStatement pst, ResultSet rs) throws SQLException, IOException {
            if (isIdentity || isSequence) {
                if (returnPkType.equals(ReturnPkType.GENERATED_KEYS)) {
                    pst = conn.prepareStatement(insertSql, PreparedStatement.RETURN_GENERATED_KEYS);
                } else if (returnPkType.equals(ReturnPkType.PREPARD_ID)) {
                    pst = conn.prepareStatement(insertSql, new String[] { entityMeta.getColumnName(entityMeta.getIdArray()[0]) });
                } else {
                    pst = conn.prepareStatement(insertSql);
                }
            } else {
                pst = conn.prepareStatement(insertSql);
            }
            SqlUtil.setParamsValue(sqlToyContext.getTypeHandler(), conn, dbType, pst, paramValues, paramsType, 0);
            ResultSet keyResult = null;
            if ((isIdentity || isSequence) && returnPkType.equals(ReturnPkType.RESULT_GET)) {
                keyResult = pst.executeQuery();
            } else {
                pst.execute();
            }
            if (isIdentity || isSequence) {
                if (!returnPkType.equals(ReturnPkType.RESULT_GET)) {
                    keyResult = pst.getGeneratedKeys();
                }
                if (keyResult != null) {
                    List result = new ArrayList();
                    while (keyResult.next()) {
                        result.add(keyResult.getObject(1));
                    }
                    if (result.size() == 1) {
                        this.setResult(result.get(0));
                    } else {
                        this.setResult(result.toArray());
                    }
                }
            }
        }
    });
    // 无主键直接返回null
    if (entityMeta.getIdArray() == null) {
        return null;
    }
    if (result == null) {
        result = fullParamValues[pkIndex];
    }
    // 回置到entity 主键值
    if (needUpdatePk || isIdentity || isSequence) {
        BeanUtil.setProperty(entity, entityMeta.getIdArray()[0], result);
    }
    return result;
}
Also used : SQLException(java.sql.SQLException) PreparedStatementResultHandler(org.sagacity.sqltoy.callback.PreparedStatementResultHandler) PKStrategy(org.sagacity.sqltoy.config.model.PKStrategy) ArrayList(java.util.ArrayList) ReflectPropsHandler(org.sagacity.sqltoy.callback.ReflectPropsHandler) PreparedStatement(java.sql.PreparedStatement) IOException(java.io.IOException) ReturnPkType(org.sagacity.sqltoy.dialect.model.ReturnPkType) ResultSet(java.sql.ResultSet) ArrayList(java.util.ArrayList) List(java.util.List)

Example 12 with ReflectPropsHandler

use of org.sagacity.sqltoy.callback.ReflectPropsHandler in project sagacity-sqltoy by chenrenfei.

the class DialectFactory method batchUpdate.

/**
 * @todo 批量执行sql修改或删除操作
 * @param sqlToyContext
 * @param sqlToyConfig
 * @param dataSet             支持List<List>、List<Object[]>(sql中?传参)
 *                            ;List<VO>、List<Map> 形式(sql中:paramName传参)
 * @param batchSize
 * @param reflectPropsHandler
 * @param insertCallhandler   使用反调方式自己对rs进行处理
 * @param autoCommit
 * @param dataSource
 * @return
 */
public Long batchUpdate(final SqlToyContext sqlToyContext, final SqlToyConfig sqlToyConfig, final List dataSet, final int batchSize, final ReflectPropsHandler reflectPropsHandler, final InsertRowCallbackHandler insertCallhandler, final Boolean autoCommit, final DataSource dataSource) {
    // 首先合法性校验
    if (dataSet == null || dataSet.isEmpty()) {
        logger.warn("batchUpdate dataSet is null or empty,please check!");
        return 0L;
    }
    try {
        // 启动执行日志(会在threadlocal中创建一个当前执行信息,并建立一个唯一跟踪id)
        SqlExecuteStat.start(sqlToyConfig.getId(), "batchUpdate:[" + dataSet.size() + "]条记录!", sqlToyConfig.isShowSql());
        Long updateTotalCnt = (Long) DataSourceUtils.processDataSource(sqlToyContext, dataSource, new DataSourceCallbackHandler() {

            @Override
            public void doConnection(Connection conn, Integer dbType, String dialect) throws Exception {
                String realSql = sqlToyConfig.getSql(dialect);
                Integer[] fieldTypes = null;
                List values = dataSet;
                // sql中存在:named参数模式,通过sql提取参数名称
                if (sqlToyConfig.getParamsName() != null) {
                    // 替换sql中:name为?并提取参数名称归集成数组
                    SqlParamsModel sqlParamsModel = SqlConfigParseUtils.processNamedParamsQuery(realSql);
                    realSql = sqlParamsModel.getSql();
                    // update 2021-10-28 增加统一授权传参、根据insert、update 判断自动补充创建人、创建时间、修改人、修改时间等属性值的填充
                    ReflectPropsHandler realPropsHandler = DialectUtils.wrapReflectWithUnifyFields(realSql, reflectPropsHandler, sqlToyContext.getUnifyFieldsHandler());
                    values = BeanUtil.reflectBeansToList(dataSet, sqlParamsModel.getParamsName(), realPropsHandler);
                    fieldTypes = BeanUtil.matchMethodsType(dataSet.get(0).getClass(), sqlParamsModel.getParamsName());
                }
                // 做sql签名
                realSql = SqlUtilsExt.signSql(realSql, dbType, sqlToyConfig);
                SqlExecuteStat.showSql("批量sql执行", realSql, null);
                this.setResult(SqlUtil.batchUpdateByJdbc(sqlToyContext.getTypeHandler(), realSql, values, batchSize, insertCallhandler, fieldTypes, autoCommit, conn, dbType));
            }
        });
        // 输出执行结果更新记录量日志
        SqlExecuteStat.debug("执行结果", "批量更新记录数量:{} 条!", updateTotalCnt);
        return updateTotalCnt;
    } catch (Exception e) {
        SqlExecuteStat.error(e);
        throw new DataAccessException(e);
    } finally {
        // 输出执行效率和超时、错误日志
        SqlExecuteStat.destroy();
    }
}
Also used : Connection(java.sql.Connection) SqlParamsModel(org.sagacity.sqltoy.config.model.SqlParamsModel) List(java.util.List) ArrayList(java.util.ArrayList) ReflectPropsHandler(org.sagacity.sqltoy.callback.ReflectPropsHandler) DataSourceCallbackHandler(org.sagacity.sqltoy.callback.DataSourceCallbackHandler) DataAccessException(org.sagacity.sqltoy.exception.DataAccessException) DataAccessException(org.sagacity.sqltoy.exception.DataAccessException)

Example 13 with ReflectPropsHandler

use of org.sagacity.sqltoy.callback.ReflectPropsHandler in project sagacity-sqltoy by chenrenfei.

the class DialectUtils method save.

/**
 * @todo 保存对象
 * @param sqlToyContext
 * @param entityMeta
 * @param pkStrategy
 * @param isAssignPK
 * @param returnPkType
 * @param insertSql
 * @param entity
 * @param generateSqlHandler
 * @param generateSavePKStrategy
 * @param conn
 * @param dbType
 * @return
 * @throws Exception
 */
public static Object save(final SqlToyContext sqlToyContext, final EntityMeta entityMeta, final PKStrategy pkStrategy, final boolean isAssignPK, final ReturnPkType returnPkType, final String insertSql, Serializable entity, final GenerateSqlHandler generateSqlHandler, final GenerateSavePKStrategy generateSavePKStrategy, final Connection conn, final Integer dbType) throws Exception {
    final boolean isIdentity = (pkStrategy != null && pkStrategy.equals(PKStrategy.IDENTITY));
    final boolean isSequence = (pkStrategy != null && pkStrategy.equals(PKStrategy.SEQUENCE));
    String[] reflectColumns;
    if ((isIdentity && !isAssignPK) || (isSequence && !isAssignPK)) {
        reflectColumns = entityMeta.getRejectIdFieldArray();
    } else {
        reflectColumns = entityMeta.getFieldsArray();
    }
    // 构造全新的新增记录参数赋值反射(覆盖之前的)
    ReflectPropsHandler handler = getAddReflectHandler(null, sqlToyContext.getUnifyFieldsHandler());
    handler = getSecureReflectHandler(handler, sqlToyContext.getFieldsSecureProvider(), sqlToyContext.getDesensitizeProvider(), entityMeta.getSecureFields());
    Object[] fullParamValues = BeanUtil.reflectBeanToAry(entity, reflectColumns, null, handler);
    boolean needUpdatePk = false;
    int pkIndex = entityMeta.getIdIndex();
    // 是否存在业务ID
    boolean hasBizId = (entityMeta.getBusinessIdGenerator() == null) ? false : true;
    int bizIdColIndex = hasBizId ? entityMeta.getFieldIndex(entityMeta.getBusinessIdField()) : 0;
    // 标识符
    String signature = entityMeta.getBizIdSignature();
    Integer[] relatedColumn = entityMeta.getBizIdRelatedColIndex();
    String[] relatedColumnNames = entityMeta.getBizIdRelatedColumns();
    int relatedColumnSize = (relatedColumn == null) ? 0 : relatedColumn.length;
    // 主键采用assign方式赋予,则调用generator产生id并赋予其值
    if (entityMeta.getIdStrategy() != null && null != entityMeta.getIdGenerator()) {
        int bizIdLength = entityMeta.getBizIdLength();
        int idLength = entityMeta.getIdLength();
        Object[] relatedColValue = null;
        String businessIdType = hasBizId ? entityMeta.getColumnJavaType(entityMeta.getBusinessIdField()) : "";
        if (relatedColumn != null) {
            relatedColValue = new Object[relatedColumnSize];
            for (int meter = 0; meter < relatedColumnSize; meter++) {
                relatedColValue[meter] = fullParamValues[relatedColumn[meter]];
                if (StringUtil.isBlank(relatedColValue[meter])) {
                    throw new IllegalArgumentException("对象:" + entityMeta.getEntityClass().getName() + " 生成业务主键依赖的关联字段:" + relatedColumnNames[meter] + " 值为null!");
                }
            }
        }
        if (StringUtil.isBlank(fullParamValues[pkIndex])) {
            // id通过generator机制产生,设置generator产生的值
            fullParamValues[pkIndex] = entityMeta.getIdGenerator().getId(entityMeta.getTableName(), signature, entityMeta.getBizIdRelatedColumns(), relatedColValue, null, entityMeta.getIdType(), idLength, entityMeta.getBizIdSequenceSize());
            needUpdatePk = true;
        }
        if (hasBizId && StringUtil.isBlank(fullParamValues[bizIdColIndex])) {
            fullParamValues[bizIdColIndex] = entityMeta.getBusinessIdGenerator().getId(entityMeta.getTableName(), signature, entityMeta.getBizIdRelatedColumns(), relatedColValue, null, businessIdType, bizIdLength, entityMeta.getBizIdSequenceSize());
            // 回写业务主键值
            BeanUtil.setProperty(entity, entityMeta.getBusinessIdField(), fullParamValues[bizIdColIndex]);
        }
    }
    SqlExecuteStat.showSql("执行单记录插入", insertSql, null);
    final Object[] paramValues = fullParamValues;
    final Integer[] paramsType = entityMeta.getFieldsTypeArray();
    PreparedStatement pst = null;
    Object result = SqlUtil.preparedStatementProcess(null, pst, null, new PreparedStatementResultHandler() {

        @Override
        public void execute(Object obj, PreparedStatement pst, ResultSet rs) throws SQLException, IOException {
            if (isIdentity || isSequence) {
                if (returnPkType.equals(ReturnPkType.GENERATED_KEYS)) {
                    pst = conn.prepareStatement(insertSql, PreparedStatement.RETURN_GENERATED_KEYS);
                } else if (returnPkType.equals(ReturnPkType.PREPARD_ID)) {
                    pst = conn.prepareStatement(insertSql, new String[] { entityMeta.getColumnName(entityMeta.getIdArray()[0]) });
                } else {
                    pst = conn.prepareStatement(insertSql);
                }
            } else {
                pst = conn.prepareStatement(insertSql);
            }
            SqlUtil.setParamsValue(sqlToyContext.getTypeHandler(), conn, dbType, pst, paramValues, paramsType, 0);
            ResultSet keyResult = null;
            if ((isIdentity || isSequence) && returnPkType.equals(ReturnPkType.RESULT_GET)) {
                keyResult = pst.executeQuery();
            } else {
                pst.execute();
            }
            if (isIdentity || isSequence) {
                if (!returnPkType.equals(ReturnPkType.RESULT_GET)) {
                    keyResult = pst.getGeneratedKeys();
                }
                if (keyResult != null) {
                    List result = new ArrayList();
                    while (keyResult.next()) {
                        result.add(keyResult.getObject(1));
                    }
                    if (result.size() == 1) {
                        this.setResult(result.get(0));
                    } else {
                        this.setResult(result.toArray());
                    }
                }
            }
        }
    });
    // 无主键直接返回null
    if (entityMeta.getIdArray() == null) {
        return null;
    }
    if (result == null) {
        result = fullParamValues[pkIndex];
    }
    // 回置到entity 主键值
    if (needUpdatePk || isIdentity || isSequence) {
        BeanUtil.setProperty(entity, entityMeta.getIdArray()[0], result);
    }
    // 判定是否有级联子表数据保存
    if (!entityMeta.getCascadeModels().isEmpty()) {
        List subTableData = null;
        EntityMeta subTableEntityMeta;
        String insertSubTableSql;
        SavePKStrategy savePkStrategy;
        for (TableCascadeModel cascadeModel : entityMeta.getCascadeModels()) {
            final String[] mappedFields = cascadeModel.getMappedFields();
            final Object[] mainValues = BeanUtil.reflectBeanToAry(entity, cascadeModel.getFields());
            subTableEntityMeta = sqlToyContext.getEntityMeta(cascadeModel.getMappedType());
            // oneToMany
            if (cascadeModel.getCascadeType() == 1) {
                subTableData = (List) BeanUtil.getProperty(entity, cascadeModel.getProperty());
            } else {
                subTableData = new ArrayList();
                Object item = BeanUtil.getProperty(entity, cascadeModel.getProperty());
                if (item != null) {
                    subTableData.add(item);
                }
            }
            if (subTableData != null && !subTableData.isEmpty()) {
                logger.info("执行save操作的级联子表{}批量保存!", subTableEntityMeta.getTableName());
                SqlExecuteStat.debug("执行子表级联保存", null);
                insertSubTableSql = generateSqlHandler.generateSql(subTableEntityMeta, null);
                savePkStrategy = generateSavePKStrategy.generate(subTableEntityMeta);
                saveAll(sqlToyContext, subTableEntityMeta, savePkStrategy.getPkStrategy(), savePkStrategy.isAssginValue(), insertSubTableSql, subTableData, sqlToyContext.getBatchSize(), new ReflectPropsHandler() {

                    public void process() {
                        for (int i = 0; i < mappedFields.length; i++) {
                            this.setValue(mappedFields[i], mainValues[i]);
                        }
                    }
                }, conn, dbType, null);
            } else {
                logger.info("未执行save操作的级联子表{}批量保存,子表数据为空!", subTableEntityMeta.getTableName());
            }
        }
    }
    return result;
}
Also used : EntityMeta(org.sagacity.sqltoy.config.model.EntityMeta) SQLException(java.sql.SQLException) PreparedStatementResultHandler(org.sagacity.sqltoy.callback.PreparedStatementResultHandler) ArrayList(java.util.ArrayList) ReflectPropsHandler(org.sagacity.sqltoy.callback.ReflectPropsHandler) PreparedStatement(java.sql.PreparedStatement) TableCascadeModel(org.sagacity.sqltoy.config.model.TableCascadeModel) IOException(java.io.IOException) ResultSet(java.sql.ResultSet) List(java.util.List) ArrayList(java.util.ArrayList) SavePKStrategy(org.sagacity.sqltoy.dialect.model.SavePKStrategy) GenerateSavePKStrategy(org.sagacity.sqltoy.callback.GenerateSavePKStrategy)

Example 14 with ReflectPropsHandler

use of org.sagacity.sqltoy.callback.ReflectPropsHandler in project sagacity-sqltoy by chenrenfei.

the class DialectUtils method update.

/**
 * @todo 单笔记录修改
 * @param sqlToyContext
 * @param entity
 * @param entityMeta
 * @param nullFunction
 * @param forceUpdateFields
 * @param conn
 * @param dbType
 * @param tableName
 * @return
 * @throws Exception
 */
public static Long update(SqlToyContext sqlToyContext, Serializable entity, EntityMeta entityMeta, String nullFunction, String[] forceUpdateFields, Connection conn, final Integer dbType, String tableName) throws Exception {
    String realTable = entityMeta.getSchemaTable(tableName, dbType);
    // 无主键
    if (entityMeta.getIdArray() == null) {
        throw new IllegalArgumentException("表:" + realTable + " 无主键,不符合update/updateAll规则,请检查表设计是否合理!");
    }
    // 全部是主键则无需update
    if (entityMeta.getRejectIdFieldArray() == null) {
        logger.warn("表:" + realTable + " 字段全部是主键不存在更新字段,无需执行更新操作!");
        return 0L;
    }
    // 构造全新的修改记录参数赋值反射(覆盖之前的)
    ReflectPropsHandler handler = getUpdateReflectHandler(null, forceUpdateFields, sqlToyContext.getUnifyFieldsHandler());
    handler = getSecureReflectHandler(handler, sqlToyContext.getFieldsSecureProvider(), sqlToyContext.getDesensitizeProvider(), entityMeta.getSecureFields());
    Object[] fieldsValues = BeanUtil.reflectBeanToAry(entity, entityMeta.getFieldsArray(), null, handler);
    // 判断主键是否为空
    int pkIndex = entityMeta.getIdIndex();
    for (int i = pkIndex; i < pkIndex + entityMeta.getIdArray().length; i++) {
        if (StringUtil.isBlank(fieldsValues[i])) {
            throw new IllegalArgumentException("通过对象对表:" + realTable + " 进行update操作,主键字段必须要赋值!");
        }
    }
    // 构建update语句
    String updateSql = generateUpdateSql(dbType, entityMeta, nullFunction, forceUpdateFields, realTable);
    if (updateSql == null) {
        throw new IllegalArgumentException("update sql is null,引起问题的原因是没有设置需要修改的字段!");
    }
    return SqlUtil.executeSql(sqlToyContext.getTypeHandler(), updateSql, fieldsValues, entityMeta.getFieldsTypeArray(), conn, dbType, null, false);
}
Also used : ReflectPropsHandler(org.sagacity.sqltoy.callback.ReflectPropsHandler)

Example 15 with ReflectPropsHandler

use of org.sagacity.sqltoy.callback.ReflectPropsHandler in project sagacity-sqltoy by chenrenfei.

the class DialectUtils method getAddReflectHandler.

/**
 * @todo 构造新增记录参数反射赋值处理器
 * @param preHandler
 * @param unifyFieldsHandler
 * @return
 */
public static ReflectPropsHandler getAddReflectHandler(final ReflectPropsHandler preHandler, IUnifyFieldsHandler unifyFieldsHandler) {
    if (unifyFieldsHandler == null) {
        return preHandler;
    }
    final Map<String, Object> keyValues = unifyFieldsHandler.createUnifyFields();
    if (keyValues == null || keyValues.isEmpty()) {
        return preHandler;
    }
    // 强制修改字段赋值
    IgnoreCaseSet tmpSet = unifyFieldsHandler.forceUpdateFields();
    final IgnoreCaseSet forceUpdateFields = (tmpSet == null) ? new IgnoreCaseSet() : tmpSet;
    ReflectPropsHandler handler = new ReflectPropsHandler() {

        @Override
        public void process() {
            if (preHandler != null) {
                preHandler.setPropertyIndexMap(this.getPropertyIndexMap());
                preHandler.setRowIndex(this.getRowIndex());
                preHandler.setRowData(this.getRowData());
                preHandler.process();
            }
            for (Map.Entry<String, Object> entry : keyValues.entrySet()) {
                if (StringUtil.isBlank(this.getValue(entry.getKey())) || forceUpdateFields.contains(entry.getKey())) {
                    this.setValue(entry.getKey(), entry.getValue());
                }
            }
        }
    };
    return handler;
}
Also used : ReflectPropsHandler(org.sagacity.sqltoy.callback.ReflectPropsHandler) Map(java.util.Map) HashMap(java.util.HashMap) IgnoreKeyCaseMap(org.sagacity.sqltoy.model.IgnoreKeyCaseMap) IgnoreCaseSet(org.sagacity.sqltoy.model.IgnoreCaseSet)

Aggregations

ReflectPropsHandler (org.sagacity.sqltoy.callback.ReflectPropsHandler)19 ArrayList (java.util.ArrayList)9 List (java.util.List)8 EntityMeta (org.sagacity.sqltoy.config.model.EntityMeta)6 HashMap (java.util.HashMap)5 TableCascadeModel (org.sagacity.sqltoy.config.model.TableCascadeModel)4 IOException (java.io.IOException)3 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 Map (java.util.Map)3 PreparedStatementResultHandler (org.sagacity.sqltoy.callback.PreparedStatementResultHandler)3 IgnoreCaseSet (org.sagacity.sqltoy.model.IgnoreCaseSet)3 IgnoreKeyCaseMap (org.sagacity.sqltoy.model.IgnoreKeyCaseMap)3 Type (java.lang.reflect.Type)2 HashSet (java.util.HashSet)2 PKStrategy (org.sagacity.sqltoy.config.model.PKStrategy)2 SqlToyResult (org.sagacity.sqltoy.config.model.SqlToyResult)2 ReturnPkType (org.sagacity.sqltoy.dialect.model.ReturnPkType)2 DBType (org.sagacity.sqltoy.utils.DataSourceUtils.DBType)2