src/jdk.incubator.adba/share/classes/jdk/incubator/sql2/package-info.java
branchJDK-8188051-branch
changeset 56828 64304e37e9b1
parent 56824 62e92191354d
child 56832 4f7713e6a308
equal deleted inserted replaced
56827:1a36ad36c9e9 56828:64304e37e9b1
   306  * should commit after the Operation that ends the transaction is submitted. But
   306  * should commit after the Operation that ends the transaction is submitted. But
   307  * if the execution of the transaction does not result in the expected results
   307  * if the execution of the transaction does not result in the expected results
   308  * it might be necessary to rollback the transaction rather than commit it. This
   308  * it might be necessary to rollback the transaction rather than commit it. This
   309  * determination depends on the execution of the Operations long after the
   309  * determination depends on the execution of the Operations long after the
   310  * endTransaction Operation is submitted. To address this mismatch, the
   310  * endTransaction Operation is submitted. To address this mismatch, the
   311  * endTransaction Operation is conditioned by a {@link TransactionEnd}. By
   311  * endTransaction Operation is conditioned by a {@link TransactionCompletion}. By
   312  * default, a {@link TransactionEnd} will cause an endTransaciton
   312  * default, a {@link TransactionCompletion} will cause an endTransaciton
   313  * {@link Operation} to commit the transaction. At any time before the
   313  * {@link Operation} to commit the transaction. At any time before the
   314  * endTransaction {@link Operation} that references it is executed a
   314  * endTransaction {@link Operation} that references it is executed a
   315  * {@link TransactionEnd} can be set to rollback the transaction .</p>
   315  * {@link TransactionCompletion} can be set to rollback the transaction .</p>
   316  *
   316  *
   317  * <p>
   317  * <p>
   318  * An endTransaction {@link Operation}, like all {@link Operation}s, is
   318  * An endTransaction {@link Operation}, like all {@link Operation}s, is
   319  * immutable once submitted. But an endTransaction {@link Operation} is created
   319  * immutable once submitted. But an endTransaction {@link Operation} is created
   320  * with a {@link TransactionEnd} and that {@link TransactionEnd} can be set to
   320  * with a {@link TransactionCompletion} and that {@link TransactionCompletion} can be set to
   321  * commit or rollback. A {@link TransactionEnd} controls the endTransaction
   321  * commit or rollback. A {@link TransactionCompletion} controls the endTransaction
   322  * {@link Operation} created with it. Using this mechanism an error handler,
   322  * {@link Operation} created with it. Using this mechanism an error handler,
   323  * result handler or other code can cause a subsequent endTransaction
   323  * result handler or other code can cause a subsequent endTransaction
   324  * {@link Operation} to rollback instead of the default which is to commit.</p>
   324  * {@link Operation} to rollback instead of the default which is to commit.</p>
   325  *
   325  *
   326  * <pre>
   326  * <pre>
   327  * {@code
   327  * {@code
   328  *   TransactionEnd t = session.getTransactionEnd();
   328  *   TransactionCompletion t = session.getTransactionEnd();
   329  *   session.countOperation(updateSql)
   329  *   session.countOperation(updateSql)
   330  *       .resultProcessor( count -> { 
   330  *       .resultProcessor( count -> { 
   331  *           if (count > 1) t.setRollbackOnly(); 
   331  *           if (count > 1) t.setRollbackOnly(); 
   332  *           return null; 
   332  *           return null; 
   333  *       } )
   333  *       } )
   337  * }
   337  * }
   338  * </pre>
   338  * </pre>
   339  *
   339  *
   340  * <p>
   340  * <p>
   341  * In this example if the update SQL modifies more than one row the result
   341  * In this example if the update SQL modifies more than one row the result
   342  * processor will set the {@link TransactionEnd} to rollback only. When the
   342  * processor will set the {@link TransactionCompletion} to rollback only. When the
   343  * endTransaction {@link Operation} submitted by
   343  * endTransaction {@link Operation} submitted by
   344  * {@link OperationGroup#commitMaybeRollback} is executed it will cause the
   344  * {@link OperationGroup#commitMaybeRollback} is executed it will cause the
   345  * transaction to rollback.</p>
   345  * transaction to rollback.</p>
   346  *
   346  *
   347  *
   347  *