BeginTransaction Hibernate necessary?
来源:互联网 发布:淘宝购物拒签会怎样 编辑:程序博客网 时间:2024/06/04 20:03
Is it really necessary to start a transaction when you are going to execute only one query, without deleting or updating data?
I’m currently using Hibernate 4.1.9 with C3p0
Example,
session session = hibernateutil.getsessionfactory().opensession();Transaction tx = session.beginTransaction();List messages = session.createQuery("from Message m order by m.text asc").list(); tx.commit();session.close();
The documentation says:
Database, or system, transaction boundaries are always necessary. No communication with the database can occur outside of a database transaction (this seems to confuse many developers who are used to the auto-commit mode). Always use clear transaction boundaries, even for read-only operations. Depending on your isolation level and database capabilities this might not be required, but there is no downside if you always demarcate transactions explicitly. Certainly, a single database transaction is going to perform better than many small transactions, even for reading data.
(emphasis mine)
- BeginTransaction Hibernate necessary?
- hibernate begintransaction throwing exception
- Hibernate的getTransaction()和beginTransaction()
- hibernate native Sql Rounding necessary 解决
- Hibernate中 session.getTransaction().commit(); 和session.beginTransaction().commit();
- Android之beginTransaction
- SQLite 事务一致性处理 beginTransaction
- getFragmentManager().beginTransaction().replace有残留
- Necessary and sufficient condition
- Linux学习四大necessary
- some necessary snapshot
- synchronized 和 beginTransaction 死锁的一个例子
- session.beginTransaction(configure build path)报错
- Job descriptions - are they necessary?
- learn English well is necessary
- java.lang.ArithmeticException: Rounding necessary
- Is it necessary to develop tourism?
- Is a Test of spoken English Necessary?
- Bode Plot - 1045
- 开发 Derby 存储过程
- 欢迎使用CSDN-markdown编辑器
- 笔记1--Ecliplse Windows工程导入Mac中文乱码
- [C++][编程风格]C++命名规则
- BeginTransaction Hibernate necessary?
- 一个PHP菜鸟的开始
- IntelliJ IDEA 14 注册码
- emoji 表情过滤 解决 sogo 输入法输入表情 服务器不支持
- 各种编程语言的深度学习库整理
- struct,class,union
- Shell简介:什么是Shell,Shell命令的两种执行方式
- iso学习网址
- 新浪微博开发-(6)自定义搜索框