import com.gctx.framework.dao.IGenericJdbcDAO;
import com.gctx.framework.logs.Logit;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
public Integer insert(final String sql, final Object[] objs)
{
Logit.debugLog(sql);
KeyHolder keyHolder = new GeneratedKeyHolder();
getJdbcTemplate().update(new PreparedStatementCreator() {
public PreparedStatement createPreparedStatement(Connection conn) {
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql, 1);
if ((objs != null) && (objs.length > 0))
for (int i = 0; i < objs.length; i++)
ps.setObject(i + 1, objs[i]);
}
catch (SQLException e)
{
Logit.errorLog(e.getMessage(), e);
}
return ps;
}
}
, keyHolder);
if ((keyHolder == null) || (keyHolder.getKey() == null)) {
return Integer.valueOf(0);
}
return Integer.valueOf(keyHolder.getKey().intValue());
}
分享到:
相关推荐
用法可可豆pod 'KeyHolder'迦太基github "Clipy/KeyHolder"github "Clipy/Magnet"github "Clipy/Sauce"例设置默认组合键。 let recordView = RecordView ( frame : CGRect. zero )recordView. tintColor = NSColor ...
可用的源代码在这里:https://github.com/antoniopelusi/KeyHolder版本1.2错误修复需要启动Java虚拟机,可以在这里使用:https://www.java.com/en/download/将密码存储在安全的地方用主密码保护的数据库
钥匙扣 密钥持有者可确保您所有密码的安全。 使用给定的主密钥对您的密码进行加密,并将手机存储在其中。 特征: 密码使用强大的AES-256加密存储。 ... 选择类别,例如金融,旅游,游戏,社交媒体等。... 任何问题:
GeneratedKeyHolder keyHolder = new GeneratedKeyHolder(); getJdbcTemplate().update(new PreparedStatementCreator() { @Override public PreparedStatement createPreparedStatement(Connection connection)...
KeyHolder KeyNamingStrategy LabeledEnum LabeledEnumResolver LabelTag LangNamespaceHandler LastModified LazyConnectionDataSourceProxy LazyInitTargetSource LazyInitTargetSourceCreator ...
KeyHolder在macOS中记录快捷方式,例如Alfred App。 用法CocoaPods pod'KeyHolder'迦太基github“ Clipy / KeyHolder” github“ Clipy / Magnet” github“ Clipy / Sauce”示例KeyHolder在macOS中记录快捷方式,...