[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2860) Consolidate Session creation options/parameters
Steve Ebersole (JIRA)
noreply at atlassian.com
Thu Mar 31 14:45:08 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41921#action_41921 ]
Steve Ebersole commented on HHH-2860:
-------------------------------------
This is implemented in a builder style. There are 2 ways.
First from a {{SessionFactory}} there is a contract {{SessionBuilder}} accessible by calling {{SessionFactory#withOptions()}}. {{SessionBuilder}} exposes a number of methods to customize how a session is to be built as well as a method {{openSession()}} to then build the session. For example:
{code}
Session session = sessionFactory.withOptions()
.connection( someConnection )
.interceptor( yourInterceptor )
.openSession();
{code}
Second from {{Session}} there is a contract {{SharedSessonBuilder}} accessible by calling {{Session#sessionWithOptions()}}. {{SharedSessonBuilder}} extends {{SessionBuilder}} and exposes a additional number of methods for customizing how a session is to be built based on the state of the starting session. For example:
{code}
Session session = session.sessionWithOptions()
.interceptor( yourInterceptor )
.transactionContext()
.openSession();
{code}
> Consolidate Session creation options/parameters
> -----------------------------------------------
>
> Key: HHH-2860
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2860
> Project: Hibernate Core
> Issue Type: Improvement
> Components: core
> Reporter: Steve Ebersole
> Assignee: Steve Ebersole
> Fix For: 4.0.0.Alpha2
>
>
> This is a partial follow-on for the deprecation of Session#connection()
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list