public static PreparedStatement createPreparedStatement(final Connection con, final String sql,
			final boolean returnKeys, final Object... args) throws SQLException {
		PreparedStatement ps;
		if (returnKeys) {
			ps = con.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
		} else {
			ps = con.prepareStatement(sql);
		}

		if (args != null) {
			for (int i = 0; i < args.length; i++) {
				Object arg = args[i];
				setParameterValue(ps, i + 1, arg);
			}
		}

		return ps;
	}