查询 更新 事务 java_提交一个查询有必要用事务吗?(转载)

如果只提交一个查询,有必要用事务吗?这个问题之前已经讨论过

但是并没有得出明确的结论。先让我们看看事务的定义:

引用:

Transactions are described in terms of ACID properties, which are as follows:

n Atomic: all changes to the database made in a transaction are rolled back if any

change fails.

n Consistent: the effects of a transaction take the database from one consistent

state to another consistent state.

n Isolated: the intermediate steps in a transaction are not visible to other users of

the database.

n Durable: when a transaction is completed (committed or rolled back), its effects

persist in the database.

即ACID的定义,从上面看来,似乎除了isolated之外,和只读查询都没有关系。那么是否只读查询不需要事务呢?

再看看Oracle对于只读事务的定义:

引用:

Read-Only Transactions

By default, Oracle guarantees statement-level read consistency. The set of data returned by a single q

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值