= TransactionServiceSpring
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Default implementation of xref:refguide:applib:index/services/xactn/TransactionService.adoc[TransactionService] , which delegates to Spring's own transaction management framework, such as _PlatformTransactionManager_ .

== API

[source,java]
.TransactionServiceSpring.java
----
class TransactionServiceSpring {
  TransactionServiceSpring(List<PlatformTransactionManager> platformTransactionManagers, List<PersistenceExceptionTranslator> persistenceExceptionTranslators, Provider<InteractionLayerTracker> interactionLayerTrackerProvider, ConfigurableListableBeanFactory configurableListableBeanFactory)
  Try<T> callTransactional(TransactionDefinition def, Callable<T> callable)
  void flushTransaction()
  Optional<TransactionId> currentTransactionId()
  TransactionState currentTransactionState()
  void onOpen(CausewayInteraction interaction)     // <.>
  void requestRollback(CausewayInteraction interaction)     // <.>
  void onClose(CausewayInteraction interaction)     // <.>
}
----

<.> xref:#onOpen_CausewayInteraction[onOpen(CausewayInteraction)]
+
--
For use only by _org.apache.causeway.core.runtimeservices.session.InteractionServiceDefault_ , sets up the initial transaction automatically against all available _PlatformTransactionManager_ s.
--
<.> xref:#requestRollback_CausewayInteraction[requestRollback(CausewayInteraction)]
+
--
For use only by _org.apache.causeway.core.runtimeservices.session.InteractionServiceDefault_ , if _org.apache.causeway.applib.services.iactnlayer.InteractionService#run(InteractionContext, ThrowingRunnable)_ or _org.apache.causeway.applib.services.iactnlayer.InteractionService#call(InteractionContext, Callable)_ (or their various overloads) result in an exception.
--
<.> xref:#onClose_CausewayInteraction[onClose(CausewayInteraction)]
+
--
For use only by _org.apache.causeway.core.runtimeservices.session.InteractionServiceDefault_ , to close the transaction initially set up in _#onOpen(CausewayInteraction)_ against all configured _PlatformTransactionManager_ s.
--

== Members

[#onOpen_CausewayInteraction]
=== onOpen(CausewayInteraction)

For use only by _org.apache.causeway.core.runtimeservices.session.InteractionServiceDefault_ , sets up the initial transaction automatically against all available _PlatformTransactionManager_ s.

[#requestRollback_CausewayInteraction]
=== requestRollback(CausewayInteraction)

For use only by _org.apache.causeway.core.runtimeservices.session.InteractionServiceDefault_ , if _org.apache.causeway.applib.services.iactnlayer.InteractionService#run(InteractionContext, ThrowingRunnable)_ or _org.apache.causeway.applib.services.iactnlayer.InteractionService#call(InteractionContext, Callable)_ (or their various overloads) result in an exception.

[#onClose_CausewayInteraction]
=== onClose(CausewayInteraction)

For use only by _org.apache.causeway.core.runtimeservices.session.InteractionServiceDefault_ , to close the transaction initially set up in _#onOpen(CausewayInteraction)_ against all configured _PlatformTransactionManager_ s.
