Skip to content
Browse files

[GEOT-4388] Instructions on using DataStore with concurrent J2EE tran…

  • Loading branch information...
1 parent 2d11aea commit f819900d65cd77d42d62f482ee231df968317c3e @aaime aaime committed Apr 20, 2013
Showing with 15 additions and 0 deletions.
  1. +15 −0 docs/user/welcome/javaEE.rst
15 docs/user/welcome/javaEE.rst
@@ -30,3 +30,18 @@ For the parts of GeoTools that use databases they have provided two mechanisms f
* As a configuration Hint when creating an EpsgAuthority
* As a connection parameter when creating a DataStore
+Spring Framework Configuration
+Spring typically provides all services through Dependency Injection (DI). Geotools uses the FactoryFinder strategy to look up factories. Both can be combined by injecting Geotools factories as Spring bean factories or simply looking up Geotools factories in the bean constructor.
+Geotools transaction management can be performed programmatically in the application code, but Spring provides its own transaction support as well.
+With the declarative model, developers typically write little or no code related to transaction management, and even do not depend on the Spring Framework transaction API, or any other transaction API.
+For using the declarative model with Geotools, it is necessary that Geotools simply uses the transaction/connection state provided by the Spring transaction manager and does not try to intervene with it.
+This is a possibly problem for JDBC datastores, but fortunately Geotools provides an api to pass external connections to it's internal transaction state (using the buildTransaction() method), which is ideally suited for this case.
+To use Geotools in conjunction with Spring transaction management, datastore operations in transactional methods must call the setTransaction() method with a request-scoped transaction object.
+This transaction should be created when an actual Spring transaction is started and contain the current connection of the active transaction.
+Possible approaches are creating a custom TransactionManager or implementing a TransactionSynchronization object that works irrespective of the actual transaction manager.
+Example code for the latter can be found `here <>`_.
+Application code should call the synchTransaction() method.

0 comments on commit f819900

Please sign in to comment.
Something went wrong with that request. Please try again.