Enhancement #301
Let GenericDao implementation be transactional
| Status: | Closed | Start: | 05/11/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 100% |
||
| Category: | Core DAO | Spent time: | 13.00 hours | |
| Target version: | 2.0.0 RC2 | Estimated time: | 12.00 hours |
Description
Currently DAO instances have to be equipped with a transactional facade to allow e.g. calls to save(…). It would be cool if we could let the instance of GenericJpaDao be transactional itself and thus allow custom DAO interfaces to work with @Transactional, too. Having that said, there are a few critical points to be considered.
- Read-only methods should be marked as with
@Transactional(readOnly=true)to trigger read only behaviour when being invoked standalone. The configuratin can always be overriden by placing a facade in front of the DAO and configure transactions there - Selection of the transaction manager to be used has to be configurable in the namespace configuration. Usually the transaction manager is configured using the
valueattribute of the annotation. This doesn't work out for us as we have to configure theTransactionInterceptormanually to use the transaction manager configured via the namespace.
Related issues
| related to Hades - Enhancement #130: Hades should regard @Transactional annotation on DAO interfaces | Closed | 10/07/2009 | ||
| precedes Hades - Task #305: Document transactionality of DAOs | Closed | 05/12/2010 | 05/12/2010 |
Associated revisions
- added
@Transactionalannotations toGenericJpaDao - references #301
- extended
GenericDaoFactoryto callprepare(…)before addingQueryExecuterMethodInterceptor QueryExecuterMethodInterceptorgets reference to instance of DAO base class, tooQueryExecuterMethodInterceptoris now able to execute methods on the base DAO instance that were redeclared inside the users DAO interface (e.g. for altering transaction configuration)GenericDaoFactoryBeannow configures aPersistenceExceptionTranslatorInterceptorinsideprepare(…)as well as an annotation awareTransactionInterceptor- extended
ClassUtilsto lookup DAO base class methods potentially overridden at the user's DAO interface - upgraded to Spring 3.0.3.BUILD-SNAPSHOT as it contains a necessary fix inside
TransactionInterceptor - references #301
- forgot to commit upgrade to Spring 3.0.3.BUILD-SNAPSHOT
- references #301
- adapted namespace configuration to allow configuring a transaction manager explicitly (required if multiple
EntityManagerFactoryBeandeclarations are used - references #301
- added integration tests for transactional behaviour and configuration
- fixes #301
History
Updated by Oliver Gierke 4 months ago
- Status changed from New to Fixed
- % Done changed from 50 to 100
Applied in changeset r10953.
Updated by Oliver Gierke 4 months ago
- Target version set to 2.0.0 RC2
Updated by Oliver Gierke 3 months ago
- Status changed from Fixed to Closed