Repository: cayenne Updated Branches: refs/heads/master 5043d7bed -> 8d7f801e6
fixing transaction docs typo; exapnding TX docs example Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/8d7f801e Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/8d7f801e Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/8d7f801e Branch: refs/heads/master Commit: 8d7f801e692fc438889e862e98ff57599676d037 Parents: 5043d7b Author: Andrus Adamchik <[email protected]> Authored: Thu Apr 14 10:03:50 2016 +0300 Committer: Andrus Adamchik <[email protected]> Committed: Thu Apr 14 10:04:03 2016 +0300 ---------------------------------------------------------------------- .../org/apache/cayenne/configuration/server/ServerModule.java | 6 ++---- .../src/docbkx/persistent-objects-objectcontext.xml | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cayenne/blob/8d7f801e/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java ---------------------------------------------------------------------- diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java index ef3f1ab..36516d9 100644 --- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java +++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java @@ -203,10 +203,8 @@ public class ServerModule implements Module { binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class); // a service to load DataSourceFactories. DelegatingDataSourceFactory - // will attempt - // to find the actual worker factory dynamically on each call depending - // on - // DataNodeDescriptor data and the environment + // will attempt to find the actual worker factory dynamically on each + // call depending on DataNodeDescriptor data and the environment binder.bind(DataSourceFactory.class).to(DelegatingDataSourceFactory.class); // a default SchemaUpdateStrategy (used when no explicit strategy is http://git-wip-us.apache.org/repos/asf/cayenne/blob/8d7f801e/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml ---------------------------------------------------------------------- diff --git a/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml b/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml index a47af25..404cab1 100644 --- a/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml +++ b/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml @@ -267,7 +267,7 @@ generic.writeProperty("name", "New Name");</programlisting>This that spans more than one Cayenne operation. E.g. two sequential commits that need to be rolled back together in case of failure. This can be done via <code>ServerRuntime.performInTransaction</code> - method:<programlisting>Integer result = runtime.performInTransaction(new TransactionalOperation<Integer>() { + method:<programlisting>Integer result = runtime.performInTransaction(() -> { // commit one or more contexts context1.commitChanges(); context2.commitChanges(); @@ -279,5 +279,10 @@ generic.writeProperty("name", "New Name");</programlisting>This // return an arbitrary result or null if we don't care about the result return 5; });</programlisting></para> + <para>When inside the transaction, current thread Transaction object can be accessed via a + static method. E.g. here is an example that initializes transaction JDBC connection with + a custom connection object + :<programlisting>Transaction tx = BaseTransaction.getThreadTransaction(); +tx.addConnection("mydatanode", myConnection); </programlisting></para> </section> </chapter>
