4.4.3 Transaction-aware DataSource Proxy 3.1.4

See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # 4.4.3 Transaction-aware DataSource Proxy - Reference Documentation Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari Version: 3.1.4 ## 4.4.3 Transaction-aware DataSource Proxy The actual `dataSource` bean is wrapped in a transaction-aware proxy so you will be given the connection that's being used by the current transaction or Hibernate `Session` if one is active. If this were not the case, then retrieving a connection from the `dataSource` would be a new connection, and you wouldn't be able to see changes that haven't been committed yet (assuming you have a sensible transaction isolation setting, e.g. `READ_COMMITTED` or better). The "real" unproxied `dataSource` is still available to you if you need access to it; its bean name is `dataSourceUnproxied`. You can access this bean like any other Spring bean, i.e. using dependency injection:

    class MyService {   def dataSourceUnproxied
       …
    }
or by pulling it from the `ApplicationContext`:
    def dataSourceUnproxied = ctx.dataSourceUnproxied
| Quick Reference (hide)