user1642358
user1642358

Reputation:

Independent transactions in Spring JDBC


I'm using the Spring JDBC (JdbcTemplate/NamedParameterJdbcTemplate) and Spring TransactionManager (DataSourceTransactionManager) in my DAO class.

I have at least 2 clients that simultaneously using DAO methods. Is it possible to open 2 definitely independent transactions with Spring JDBC/Tx, and use one separate transaction for every client?

Currently, using the PROPAGATION_REQUIRED_NEW parameter when creating the second transaction - I got only the nested transaction, i.e. it should be committed only before the first transaction.

Upvotes: 2

Views: 472

Answers (1)

duffymo
duffymo

Reputation: 308998

Each of your two requests will have their own transaction context.

You can determine how serializable they are by setting the isolation level on your connection.

Upvotes: 0

Related Questions