Added "managed" option for current_session_context_class

git-svn-id: https://svn.jboss.org/repos/hibernate/trunk/Hibernate3/doc@9229 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Christian Bauer 2006-02-07 20:42:41 +00:00
parent f023324449
commit d9e818a6eb
2 changed files with 18 additions and 10 deletions

View File

@ -265,7 +265,7 @@
</para> </para>
</sect1> </sect1>
<sect1 id="architecture-current-session" revision="1"> <sect1 id="architecture-current-session" revision="2">
<title>Contextual Sessions</title> <title>Contextual Sessions</title>
<para> <para>
Most applications using Hibernate need some form of "contextual" sessions, where a given Most applications using Hibernate need some form of "contextual" sessions, where a given
@ -316,16 +316,24 @@
sessions are tracked by thread of execution. Again, see the Javadocs for details. sessions are tracked by thread of execution. Again, see the Javadocs for details.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
<literal>org.hibernate.context.ManagedSessionContext</literal> - current
sessions are tracked by thread of execution. However, you are responsible to
bind and unbind a <literal>Session</literal> instance with static methods
on this class, it does never open, flush, or close a <literal>Session</literal>.
</para>
</listitem>
</itemizedlist> </itemizedlist>
<para> <para>
Both implementations provide a "one session - one database transaction" programming The first two implementations provide a "one session - one database transaction" programming
model, also known and used as <emphasis>session-per-request</emphasis>. The beginning model, also known and used as <emphasis>session-per-request</emphasis>. The beginning
and end of a Hibernate session is defined by the duration of a database transaction. and end of a Hibernate session is defined by the duration of a database transaction.
If you use programatic transaction demarcation (e.g. in pure J2SE or with If you use programatic transaction demarcation in plain JSE without JTA, you are adviced to
JTA/UserTransaction/BMT), you are adviced to use the Hibernate <literal>Transaction</literal> use the Hibernate <literal>Transaction</literal> API to hide the underlying transaction system
API to hide the underlying transaction system from your code. If you execute in from your code. If you use JTA, use the JTA interfaces to demarcate transactions. If you
an EJB container that supports CMT, transaction boundaries are defined declaratively execute in an EJB container that supports CMT, transaction boundaries are defined declaratively
and you don't need any transaction or session demarcation operations in your code. and you don't need any transaction or session demarcation operations in your code.
Refer to <xref linkend="transactions"/> for more information and code examples. Refer to <xref linkend="transactions"/> for more information and code examples.
</para> </para>
@ -337,8 +345,8 @@
but a <literal>org.hibernate.transaction.TransactionManagerLookup</literal> is configured, but a <literal>org.hibernate.transaction.TransactionManagerLookup</literal> is configured,
Hibernate will use the <literal>org.hibernate.context.JTASessionContext</literal>. Hibernate will use the <literal>org.hibernate.context.JTASessionContext</literal>.
Typically, the value of this parameter would just name the implementation class to Typically, the value of this parameter would just name the implementation class to
use; for the two out-of-the-box implementations, however, there are two corresponding use; for the three out-of-the-box implementations, however, there are two corresponding
short names, "jta" and "thread". short names, "jta", "thread", and "managed".
</para> </para>
</sect1> </sect1>

View File

@ -920,7 +920,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect]]></programlisting>
</tgroup> </tgroup>
</table> </table>
<table frame="topbot" id="configuration-misc-properties" revision="9"> <table frame="topbot" id="configuration-misc-properties" revision="10">
<title>Miscellaneous Properties</title> <title>Miscellaneous Properties</title>
<tgroup cols="2"> <tgroup cols="2">
<colspec colname="c1" colwidth="1*"/> <colspec colname="c1" colwidth="1*"/>
@ -944,7 +944,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect]]></programlisting>
<para> <para>
<emphasis role="strong">eg.</emphasis> <emphasis role="strong">eg.</emphasis>
<literal>jta</literal> | <literal>thread</literal> | <literal>jta</literal> | <literal>thread</literal> |
<literal>custom.Class</literal> <literal>managed</literal> | <literal>custom.Class</literal>
</para> </para>
</entry> </entry>
</row> </row>