读书人

Session 界别

发布时间: 2012-09-17 12:06:51 作者: rapoo

Session 区分

1.?????? What’s the difference between SessionFactory.getCurrentSession() and SessionFactory.opeSession();

If get current session is null, session factory will create a new session replace of current session.

Current session will be close automatically after session get transaction commit.

Open session is always a new session was created.

2.?????? Hibernate transation implements in JDBC

JDBC?????????????????????????????????????????????????????????????????????

Hibernate

Connector.setAutoCommit(false)

session.beginTransaction();

Connector.commit()

session.getTransaction().commit()

Connector.setAutoCommit(true)

???????????????????????????????????????????????

读书人网 >软件架构设计

热点推荐