Java Code Examples for org.springframework.jdbc.core.simple.SimpleJdbcInsert#execute()
The following examples show how to use
org.springframework.jdbc.core.simple.SimpleJdbcInsert#execute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DbInsert.java From yue-library with Apache License 2.0 | 5 votes |
/** * 向表中插入一条数据 * * @param tableName 表名 * @param paramJson 参数 */ @Transactional public void insertNotReturn(String tableName, JSONObject paramJson) { // 1. 移除空对象 MapUtils.removeEmpty(paramJson); // 2. 插入源初始化 tableName = dialect.getWrapper().wrap(tableName); paramJson = dialect.getWrapper().wrap(paramJson); SimpleJdbcInsert simpleJdbcInsert = insertInit(tableName, paramJson); // 3. 执行 simpleJdbcInsert.execute(paramJson); }
Example 2
Source File: TaskStartTests.java From spring-cloud-task with Apache License 2.0 | 5 votes |
private void enableLock(String lockKey) { SimpleJdbcInsert taskLockInsert = new SimpleJdbcInsert(this.dataSource) .withTableName("TASK_LOCK"); Map<String, Object> taskLockParams = new HashMap<>(); taskLockParams.put("LOCK_KEY", UUID.nameUUIDFromBytes(lockKey.getBytes()).toString()); taskLockParams.put("REGION", "DEFAULT"); taskLockParams.put("CLIENT_ID", "aClientID"); taskLockParams.put("CREATED_DATE", new Date()); taskLockInsert.execute(taskLockParams); }