flush all sub sessions before commit when 2PC is not used

Description

When 2PC is not used, it can be interesting to minimize the risk and flush all operations before running all the commits.
We might be able to guess that and disable the internal Hibernate flush for each session in this case,
we also could let this as a recommended pattern for users (trigger flush manually before commit)
or we could do it during transaction.commit() maybe optionally (define a flag property)

Environment

None

Activity

Show:
Max Ross
January 11, 2008, 5:59 AM

Doing everything we reasonably can to avoid a partial-success situation makes a ton of sense. How would we detect that 2PC isn't being used?

Emmanuel Bernard
January 11, 2008, 11:40 AM

The hibernate.transaction.factory_class
can give a clue. If it's JDBCTransactionFactory that's not 2PC
If it's CMTTransactionFactory, JoinableCMTTransactionFactory, JTATransactionFactory, the underlying resources are JTA, I imagine the Appserver/JTA coordinater will yell if more than one resource is not XA (am I correct?)
So we could try and guess based on that.

The other strategy is to ask the user to tell us through a shard property

Assignee

Max Ross

Reporter

Emmanuel Bernard

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

Priority

Minor
Configure