boxlets = customBoxlets.toArray(new String[customBoxlets.size()]);
}
final String[] finalBoxlets = boxlets;
if (jdbcTemplate.update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection con) throws SQLException {
PreparedStatement st = con.prepareStatement("UPDATE user_settings SET settings=?, main=? WHERE id=?");
st.setObject(1, profile.getSettings());
if (finalBoxlets!=null) {
st.setArray(2, con.createArrayOf("text", finalBoxlets));
} else {
st.setNull(2, Types.ARRAY);
}
st.setInt(3, user.getId());
return st;
}
})==0) {
jdbcTemplate.update(
new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(Connection con) throws SQLException {
PreparedStatement st = con.prepareStatement("INSERT INTO user_settings (id, settings, main) VALUES (?,?,?)");
st.setInt(1, user.getId());