@Override public String add(final JSONObject jsonObject) throws RepositoryException { final JdbcTransaction currentTransaction = TX.get(); if (null == currentTransaction) { throw new RepositoryException("Invoking add() outside a transaction"); } final Connection connection = getConnection(); final List<Object> paramList = new ArrayList<>(); final StringBuilder sql = new StringBuilder(); String ret; try { if (Latkes.RuntimeDatabase.ORACLE == Latkes.getRuntimeDatabase()) { toOracleClobEmpty(jsonObject); } ret = buildAddSql(jsonObject, paramList, sql); JdbcUtil.executeSql(sql.toString(), paramList, connection, debug); JdbcUtil.fromOracleClobEmpty(jsonObject); } catch (final Exception e) { LOGGER.log(Level.ERROR, "Add failed", e); throw new RepositoryException(e); } return ret; }
@Override public void update(final String id, final JSONObject jsonObject) throws RepositoryException { if (StringUtils.isBlank(id)) { return; } final JdbcTransaction currentTransaction = TX.get(); if (null == currentTransaction) { throw new RepositoryException("Invoking update() outside a transaction"); } final JSONObject oldJsonObject = get(id); final Connection connection = getConnection(); final List<Object> paramList = new ArrayList<>(); final StringBuilder sqlBuilder = new StringBuilder(); try { if (Latkes.RuntimeDatabase.ORACLE == Latkes.getRuntimeDatabase()) { toOracleClobEmpty(jsonObject); } update(id, oldJsonObject, jsonObject, paramList, sqlBuilder); JdbcUtil.fromOracleClobEmpty(jsonObject); final String sql = sqlBuilder.toString(); if (StringUtils.isBlank(sql)) { return; } JdbcUtil.executeSql(sql, paramList, connection, debug); } catch (final Exception e) { LOGGER.log(Level.ERROR, "Update failed", e); throw new RepositoryException(e); } }
fromOracleClobEmpty(jsonObject);
@Override public void update(final String id, final JSONObject jsonObject) throws RepositoryException { if (StringUtils.isBlank(id)) { return; } final JdbcTransaction currentTransaction = TX.get(); if (null == currentTransaction) { throw new RepositoryException("Invoking update() outside a transaction"); } final JSONObject oldJsonObject = get(id); final Connection connection = getConnection(); final List<Object> paramList = new ArrayList<>(); final StringBuilder sqlBuilder = new StringBuilder(); try { if (Latkes.RuntimeDatabase.ORACLE == Latkes.getRuntimeDatabase()) { toOracleClobEmpty(jsonObject); } update(id, oldJsonObject, jsonObject, paramList, sqlBuilder); JdbcUtil.fromOracleClobEmpty(jsonObject); final String sql = sqlBuilder.toString(); if (StringUtils.isBlank(sql)) { return; } JdbcUtil.executeSql(sql, paramList, connection, debug); } catch (final Exception e) { LOGGER.log(Level.ERROR, "Update failed", e); throw new RepositoryException(e); } }
@Override public String add(final JSONObject jsonObject) throws RepositoryException { final JdbcTransaction currentTransaction = TX.get(); if (null == currentTransaction) { throw new RepositoryException("Invoking add() outside a transaction"); } final Connection connection = getConnection(); final List<Object> paramList = new ArrayList<>(); final StringBuilder sql = new StringBuilder(); String ret; try { if (Latkes.RuntimeDatabase.ORACLE == Latkes.getRuntimeDatabase()) { toOracleClobEmpty(jsonObject); } ret = buildAddSql(jsonObject, paramList, sql); JdbcUtil.executeSql(sql.toString(), paramList, connection, debug); JdbcUtil.fromOracleClobEmpty(jsonObject); } catch (final Exception e) { LOGGER.log(Level.ERROR, "Add failed", e); throw new RepositoryException(e); } return ret; }
fromOracleClobEmpty(jsonObject);