Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.xream.x7.repository.jdbctemplate;
import io.xream.sqli.core.BaseFinder;
import io.xream.sqli.core.RowHandler;
import io.xream.sqli.core.XFinder;
import io.xream.sqli.dialect.Dialect;
import io.xream.sqli.exception.ExceptionTranslator;
import io.xream.sqli.mapping.XHelpful;
import io.xream.sqli.parser.Parsed;
import io.xream.sqli.spi.JdbcHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.ColumnMapRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.SingleColumnRowMapper;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* @author Sim
*/
public final class JdbcTemplateHelper implements JdbcHelper {
private final Logger logger = LoggerFactory.getLogger(JdbcHelper.class);
private JdbcTemplate jdbcTemplate;
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
@Override
public boolean createBatch(Class clzz, String sql, BatchObjectValues batchObjectValues, int batchSize, Dialect dialect) {
this.jdbcTemplate.batchUpdate(sql, batchObjectValues.valuesList(), batchSize, (pstmt, o) -> {
int i = 1;
for (Object value : o) {
pstmt.setObject(i++, value);
}
});
return true;
}
@Override
public boolean create(boolean isAutoIncreaseId, String sql, List