You are on page 1of 6

Transactions

hybris Commerce
Developer Training
Part I
Copyright hybris AG

Transactions
Licensed to
ACME CORP
for internal training

Transactions are ACID (atomic, consistent, isolated, durable)

Hybris provides implementation of spring PlatformTransactionManager


so you can use:
@Transaction
tx xml schema
TransactionTemplate
Or direct hybris API

The JTA UserTransaction interface is not provided

hybris doesnt participate in global transactions of multiple systems

Transactions Overview | 93
Copyright hybris AG

Transactions isolation
Licensed to
ACME CORP
for internal training

Isolation level is fixed to READ_COMMITED


you cant change that with @Transactional annotation (ignored)

Nested transactions are supported


inner transaction simply joins outer transaction

Models are persisted without transaction by default:
model.service.transactional.saves=false

More info at:

wiki.hybris.com/display/release5/Transactions

Transactions Overview | 94
Copyright hybris AG

Annotation example
Licensed to
ACME CORP
for internal training

The easiest way to enable transactions in your code


@Transactional(propagation=Propagation.REQUIRES_NEW,
isolation=SERIALIZABLE)
public void provideService()
{
repo1.retrieveFoo();
repo2.retrieveFoo();
}


Notice the isolation level will be ignored!

Transactions Overview | 95

You might also like