@Test void update() { Database database = Database.newBuilder() .defaultSqlExecutor(sqlExecutor) .build(); SalespersonRow salesperson = IntegrationTest.aRandomSalesperson(); database.update(salesperson); verify(sqlExecutor).update(sqlCaptor.capture(), argCaptor.capture()); assertThat(sqlCaptor.getValue(), is("update SIESTA.SALESPERSON " + "set FIRST_NAME = ?, MIDDLE_NAMES = ?, SURNAME = ?, NUMBER_OF_SALES = ?, COMMISSION = ? " + "where SIESTA.SALESPERSON.SALESPERSON_ID = ?")); assertThat(argCaptor.getValue(), arrayContaining( salesperson.firstName(), salesperson.middleNames().orElse(null), salesperson.surname(), salesperson.numberOfSales(), salesperson.commission().orElse(null), salesperson.salespersonId() )); }
public <U> InSetExpectingWhere<U> update(Alias<U> alias) { return Update.update(this, alias); }
Database { public <U> InSetExpectingWhere<U> update(Alias<U> alias) { return Update.update(this, alias); } }
Database { public <U> InSetExpectingWhere<U> update(Alias<U> alias) { return Update.update(this, alias); } private  Database(Builder builder); }
Database { public <U> InSetExpectingWhere<U> update(Alias<U> alias) { return Update.update(this, alias); } private  Database(Builder builder); String defaultCatalog(); String defaultSchema(); NamingStrategy namingStrategy(); Dialect dialect(); Sequence<Integer> sequence(String name); Sequence<T> sequence(Class<T> valueClass, String name); @SuppressWarnings("WeakerAccess") Sequence<T> sequence(Class<T> valueClass, String catalog, String schema, String name); UncheckedAutoCloseable withLockTimeout(long time, TimeUnit unit); @SuppressWarnings("WeakerAccess") UncheckedAutoCloseable withLockTimeout(SqlExecutor executor, long time, TimeUnit unit); UncheckedAutoCloseable withLockTimeout(Transaction transaction, long time, TimeUnit unit); @SuppressWarnings("unchecked") Table<R> table(Class<R> rowClass); Table<R> table(TypeToken<R> rowType); ZoneId databaseTimeZone(); T execute(String sql, Supplier<T> statement); T translateException(String sql, Throwable throwable); String columnNameFor(MethodInfo<R,T> getterMethod); String columnNameFor(FieldInfo<R,T> fieldInfo); DataType<T> getDataTypeOf(MethodInfo<R,T> getterInfo); DataType<T> getDataTypeOf(T value); DataType<T> getDataTypeOf(Class<T> valueClass); DataType<T> getDataTypeOf(TypeToken<T> valueClass); @SuppressWarnings("WeakerAccess") Optional<DataType<T>> dataTypeOf(MethodInfo<R,T> getterInfo); Optional<DataType<T>> dataTypeOf(FieldInfo<R,T> fieldInfo); Column<T,R> column(Function1<R,T> getter); Column<T,R> column(FunctionOptional1<R,T> getter); Column<T,R> column(MethodInfo<R,T> methodInfo); SqlExecutor getDefaultSqlExecutor(); Transaction beginTransaction(); CommonTableExpressionBuilder with(String name); InProjectionExpectingComma1<T> select(TypedExpression<T> what); InProjectionExpectingComma1<T> select(TypedExpression<T> what, String label); ExpectingJoin1<R> from(Class<R> rowClass); ExpectingJoin1<R> from(Alias<R> alias); ExpectingJoin1<R> from(CommonTableExpression<R> cte, String aliasName); ExpectingJoin1<R> from(CommonTableExpression<R> cte); ExpectingJoin1<R> from(Class<R> rowClass, String alias); @SuppressWarnings("unchecked") int insert(R... rows); @SuppressWarnings("unchecked") int insert(SqlExecutor sqlExecutor, R... rows); @SuppressWarnings("unchecked") int insert(Transaction transaction, R... rows); InSetExpectingWhere<U> update(Alias<U> alias); InSetExpectingWhere<U> update(Class<U> rowClass); InSetExpectingWhere<U> update(Class<U> rowClass, String alias); @SuppressWarnings("UnusedReturnValue") int update(R row); @SuppressWarnings("unchecked") int update(SqlExecutor sqlExecutor, R row); @SuppressWarnings({"unchecked", "UnusedReturnValue"}) int update(Transaction transaction, R row); ExpectingWhere delete(Alias<D> alias); ExpectingWhere delete(Class<D> rowClass); ExpectingWhere delete(Class<D> rowClass, String alias); @SuppressWarnings("UnusedReturnValue") int delete(R row); @SuppressWarnings("unchecked") int delete(SqlExecutor sqlExecutor, R row); @SuppressWarnings({"unchecked", "UnusedReturnValue"}) int delete(Transaction transaction, R row); static Builder newBuilder(); }
Database { public <U> InSetExpectingWhere<U> update(Alias<U> alias) { return Update.update(this, alias); } private  Database(Builder builder); String defaultCatalog(); String defaultSchema(); NamingStrategy namingStrategy(); Dialect dialect(); Sequence<Integer> sequence(String name); Sequence<T> sequence(Class<T> valueClass, String name); @SuppressWarnings("WeakerAccess") Sequence<T> sequence(Class<T> valueClass, String catalog, String schema, String name); UncheckedAutoCloseable withLockTimeout(long time, TimeUnit unit); @SuppressWarnings("WeakerAccess") UncheckedAutoCloseable withLockTimeout(SqlExecutor executor, long time, TimeUnit unit); UncheckedAutoCloseable withLockTimeout(Transaction transaction, long time, TimeUnit unit); @SuppressWarnings("unchecked") Table<R> table(Class<R> rowClass); Table<R> table(TypeToken<R> rowType); ZoneId databaseTimeZone(); T execute(String sql, Supplier<T> statement); T translateException(String sql, Throwable throwable); String columnNameFor(MethodInfo<R,T> getterMethod); String columnNameFor(FieldInfo<R,T> fieldInfo); DataType<T> getDataTypeOf(MethodInfo<R,T> getterInfo); DataType<T> getDataTypeOf(T value); DataType<T> getDataTypeOf(Class<T> valueClass); DataType<T> getDataTypeOf(TypeToken<T> valueClass); @SuppressWarnings("WeakerAccess") Optional<DataType<T>> dataTypeOf(MethodInfo<R,T> getterInfo); Optional<DataType<T>> dataTypeOf(FieldInfo<R,T> fieldInfo); Column<T,R> column(Function1<R,T> getter); Column<T,R> column(FunctionOptional1<R,T> getter); Column<T,R> column(MethodInfo<R,T> methodInfo); SqlExecutor getDefaultSqlExecutor(); Transaction beginTransaction(); CommonTableExpressionBuilder with(String name); InProjectionExpectingComma1<T> select(TypedExpression<T> what); InProjectionExpectingComma1<T> select(TypedExpression<T> what, String label); ExpectingJoin1<R> from(Class<R> rowClass); ExpectingJoin1<R> from(Alias<R> alias); ExpectingJoin1<R> from(CommonTableExpression<R> cte, String aliasName); ExpectingJoin1<R> from(CommonTableExpression<R> cte); ExpectingJoin1<R> from(Class<R> rowClass, String alias); @SuppressWarnings("unchecked") int insert(R... rows); @SuppressWarnings("unchecked") int insert(SqlExecutor sqlExecutor, R... rows); @SuppressWarnings("unchecked") int insert(Transaction transaction, R... rows); InSetExpectingWhere<U> update(Alias<U> alias); InSetExpectingWhere<U> update(Class<U> rowClass); InSetExpectingWhere<U> update(Class<U> rowClass, String alias); @SuppressWarnings("UnusedReturnValue") int update(R row); @SuppressWarnings("unchecked") int update(SqlExecutor sqlExecutor, R row); @SuppressWarnings({"unchecked", "UnusedReturnValue"}) int update(Transaction transaction, R row); ExpectingWhere delete(Alias<D> alias); ExpectingWhere delete(Class<D> rowClass); ExpectingWhere delete(Class<D> rowClass, String alias); @SuppressWarnings("UnusedReturnValue") int delete(R row); @SuppressWarnings("unchecked") int delete(SqlExecutor sqlExecutor, R row); @SuppressWarnings({"unchecked", "UnusedReturnValue"}) int delete(Transaction transaction, R row); static Builder newBuilder();  }