首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

hibernate session 治理

2012-08-02 
hibernate session 管理1. Session per Operation (Anti pattern)?2. Session per Requestuse Open Sessi

hibernate session 管理

1. Session per Operation (Anti pattern)

?

2. Session per Request

use "Open Session In View" when rendering layer seperate from servlet, e.g. in JSP

?

3. Session per Request with detached object

when a user case spans several transaction, considering the user think time, we can detach and re-attach

the object to different session. Here we mean one session on transaction. For making sure only one user modifying that data, we need to user optimistic lock such as automatic versioning to isolate business use case.

?

4. Session per Conversation

the Hibernate Session can be disconnected from the underlying JDBC connection after the database transaction has been committed and reconnected when a new client request occurs. This pattern is known as session-per-conversation and makes even reattachment unnecessary. Automatic versioning is used to isolate concurrent modifications and the Session will not be allowed to be flushed automatically, but explicitly.

热点排行