[
https://issues.apache.org/jira/browse/CAY-2954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrus Adamchik closed CAY-2954.
--------------------------------
Fix Version/s: 5.0-M3
Resolution: Fixed
> Don't wrap selecting queries in transactions
> --------------------------------------------
>
> Key: CAY-2954
> URL: https://issues.apache.org/jira/browse/CAY-2954
> Project: Cayenne
> Issue Type: Improvement
> Reporter: Andrus Adamchik
> Assignee: Andrus Adamchik
> Priority: Major
> Fix For: 5.0-M3
>
>
> Cayenne surrounds every DB interaction with a transaction. This doesn't make
> sense for single select operations (the only case where it would is long
> running externally managed transactions, where selects should see uncommitted
> DB state produced by prior changes; though should be handled at the
> DataSource level).
> Per our benchmarks (see below), running selects in an auto-commit mode
> produces significant performance benefits (for the app and the DB both).
> So let's bypass implicit transactions when we can. Since Cayenne has no idea
> whether the query requires a tx or not, the indicator should be provided by
> the query itself ({{{}q.getMetadata().isReadOnly(){}}}). Most queries know
> whether they are "read-only" or not. For those that don't (such as
> ProcedureQuery) it will default to "false".
> h2. Upgrade Notes
> * Transaction listeners will no long receive begin/commit/rollback events.
> That's a breaking change, but also looks like the correct thing to do.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)