HHH-6193 - Split org.hibernate.context package into api/spi/internal

This commit is contained in:
Steve Ebersole 2011-05-04 15:25:39 -05:00
parent 36ba1bcafb
commit 3090fe9c1d
18 changed files with 27 additions and 31 deletions

View File

@ -29,11 +29,11 @@
<entry> <entry>
<para> <para>
Indicates that a session was left associated with the Indicates that a session was left associated with the
<classname>org.hibernate.context.ThreadLocalSessionContext</classname> that is used <classname>org.hibernate.context.internal.ThreadLocalSessionContext</classname> that is used
to implement thread-based current session management. Internally that class uses a to implement thread-based current session management. Internally that class uses a
ThreadLocal, and in environments where Threads are pooled this could represent a ThreadLocal, and in environments where Threads are pooled this could represent a
potential "bleed through" situation. Consider using a different potential "bleed through" situation. Consider using a different
<interfacename>org.hibernate.context.CurrentSessionContext</interfacename> <interfacename>org.hibernate.context.spi.CurrentSessionContext</interfacename>
implementation. Otherwise, make sure the sessions always get unbound properly. implementation. Otherwise, make sure the sessions always get unbound properly.
</para> </para>
</entry> </entry>

View File

@ -235,12 +235,12 @@
<para> <para>
However, as of version 3.1, the processing behind However, as of version 3.1, the processing behind
<literal>SessionFactory.getCurrentSession()</literal> is now pluggable. To that <literal>SessionFactory.getCurrentSession()</literal> is now pluggable. To that
end, a new extension interface, <literal>org.hibernate.context.CurrentSessionContext</literal>, end, a new extension interface, <literal>org.hibernate.context.spi.CurrentSessionContext</literal>,
and a new configuration parameter, <literal>hibernate.current_session_context_class</literal>, and a new configuration parameter, <literal>hibernate.current_session_context_class</literal>,
have been added to allow pluggability of the scope and context of defining current sessions. have been added to allow pluggability of the scope and context of defining current sessions.
</para> </para>
<para> <para>
See the Javadocs for the <literal>org.hibernate.context.CurrentSessionContext</literal> See the Javadocs for the <literal>org.hibernate.context.spi.CurrentSessionContext</literal>
interface for a detailed discussion of its contract. It defines a single method, interface for a detailed discussion of its contract. It defines a single method,
<literal>currentSession()</literal>, by which the implementation is responsible for <literal>currentSession()</literal>, by which the implementation is responsible for
tracking the current contextual session. Out-of-the-box, Hibernate comes with three tracking the current contextual session. Out-of-the-box, Hibernate comes with three
@ -250,7 +250,7 @@
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
<literal>org.hibernate.context.JTASessionContext</literal>: current sessions <literal>org.hibernate.context.internal.JTASessionContext</literal>: current sessions
are tracked and scoped by a <literal>JTA</literal> transaction. The processing are tracked and scoped by a <literal>JTA</literal> transaction. The processing
here is exactly the same as in the older JTA-only approach. See the Javadocs here is exactly the same as in the older JTA-only approach. See the Javadocs
for details. for details.
@ -258,13 +258,13 @@
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<literal>org.hibernate.context.ThreadLocalSessionContext</literal>:current <literal>org.hibernate.context.internal.ThreadLocalSessionContext</literal>:current
sessions are tracked by thread of execution. See the Javadocs for details. sessions are tracked by thread of execution. See the Javadocs for details.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<literal>org.hibernate.context.ManagedSessionContext</literal>: current <literal>org.hibernate.context.internal.ManagedSessionContext</literal>: current
sessions are tracked by thread of execution. However, you are responsible to sessions are tracked by thread of execution. However, you are responsible to
bind and unbind a <literal>Session</literal> instance with static methods bind and unbind a <literal>Session</literal> instance with static methods
on this class: it does not open, flush, or close a <literal>Session</literal>. on this class: it does not open, flush, or close a <literal>Session</literal>.
@ -286,10 +286,10 @@
<para> <para>
The <literal>hibernate.current_session_context_class</literal> configuration parameter The <literal>hibernate.current_session_context_class</literal> configuration parameter
defines which <literal>org.hibernate.context.CurrentSessionContext</literal> implementation defines which <literal>org.hibernate.context.spi.CurrentSessionContext</literal> implementation
should be used. For backwards compatibility, if this configuration parameter is not set should be used. For backwards compatibility, if this configuration parameter is not set
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.internal.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 three out-of-the-box implementations, however, there are three corresponding use. For the three out-of-the-box implementations, however, there are three corresponding
short names: "jta", "thread", and "managed". short names: "jta", "thread", and "managed".

View File

@ -73,11 +73,11 @@ public interface SessionFactory extends Referenceable, Serializable {
/** /**
* Obtains the current session. The definition of what exactly "current" * Obtains the current session. The definition of what exactly "current"
* means controlled by the {@link org.hibernate.context.CurrentSessionContext} impl configured * means controlled by the {@link org.hibernate.context.spi.CurrentSessionContext} impl configured
* for use. * for use.
* <p/> * <p/>
* Note that for backwards compatibility, if a {@link org.hibernate.context.CurrentSessionContext} * Note that for backwards compatibility, if a {@link org.hibernate.context.spi.CurrentSessionContext}
* is not configured but JTA is configured this will default to the {@link org.hibernate.context.JTASessionContext} * is not configured but JTA is configured this will default to the {@link org.hibernate.context.internal.JTASessionContext}
* impl. * impl.
* *
* @return The current session. * @return The current session.

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.collection.spi; package org.hibernate.collection.internal;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
@ -34,6 +34,7 @@ import java.util.ListIterator;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.LazyInitializationException; import org.hibernate.LazyInitializationException;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.CollectionEntry; import org.hibernate.engine.CollectionEntry;
import org.hibernate.engine.EntityEntry; import org.hibernate.engine.EntityEntry;
import org.hibernate.engine.ForeignKeys; import org.hibernate.engine.ForeignKeys;

View File

@ -35,7 +35,6 @@ import org.jboss.logging.Logger;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.loader.CollectionAliases; import org.hibernate.loader.CollectionAliases;

View File

@ -34,7 +34,6 @@ import java.util.ListIterator;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.loader.CollectionAliases; import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;

View File

@ -35,7 +35,6 @@ import org.dom4j.Element;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.loader.CollectionAliases; import org.hibernate.loader.CollectionAliases;

View File

@ -36,7 +36,6 @@ import java.util.Map;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.loader.CollectionAliases; import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;

View File

@ -37,7 +37,6 @@ import org.dom4j.Element;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.internal.util.collections.CollectionHelper;

View File

@ -34,7 +34,6 @@ import java.util.ListIterator;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.loader.CollectionAliases; import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;

View File

@ -36,7 +36,6 @@ import java.util.Set;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.loader.CollectionAliases; import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;

View File

@ -35,7 +35,6 @@ import java.util.Set;
import org.hibernate.EntityMode; import org.hibernate.EntityMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.collection.spi.AbstractPersistentCollection;
import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SessionImplementor;
import org.hibernate.loader.CollectionAliases; import org.hibernate.loader.CollectionAliases;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.context; package org.hibernate.context.internal;
import javax.transaction.Synchronization; import javax.transaction.Synchronization;
import javax.transaction.Transaction; import javax.transaction.Transaction;
@ -33,6 +33,7 @@ import org.jboss.logging.Logger;
import org.hibernate.ConnectionReleaseMode; import org.hibernate.ConnectionReleaseMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.context.spi.CurrentSessionContext;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.context; package org.hibernate.context.internal;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -29,10 +29,11 @@ import java.util.Map;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.context.spi.CurrentSessionContext;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
/** /**
* Represents a {@link CurrentSessionContext} the notion of a contextual session * Represents a {@link org.hibernate.context.spi.CurrentSessionContext} the notion of a contextual session
* is managed by some external entity (generally some form of interceptor, etc). * is managed by some external entity (generally some form of interceptor, etc).
* This external manager is responsible for scoping these contextual sessions * This external manager is responsible for scoping these contextual sessions
* appropriately binding/unbinding them here for exposure to the application * appropriately binding/unbinding them here for exposure to the application

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.context; package org.hibernate.context.internal;
import javax.transaction.Synchronization; import javax.transaction.Synchronization;
import java.io.IOException; import java.io.IOException;
@ -39,6 +39,7 @@ import org.jboss.logging.Logger;
import org.hibernate.ConnectionReleaseMode; import org.hibernate.ConnectionReleaseMode;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.context.spi.CurrentSessionContext;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor * 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
package org.hibernate.context; package org.hibernate.context.spi;
import java.io.Serializable; import java.io.Serializable;

View File

@ -78,10 +78,10 @@ import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Settings; import org.hibernate.cfg.Settings;
import org.hibernate.context.CurrentSessionContext; import org.hibernate.context.internal.ThreadLocalSessionContext;
import org.hibernate.context.JTASessionContext; import org.hibernate.context.spi.CurrentSessionContext;
import org.hibernate.context.ManagedSessionContext; import org.hibernate.context.internal.JTASessionContext;
import org.hibernate.context.ThreadLocalSessionContext; import org.hibernate.context.internal.ManagedSessionContext;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.SQLFunctionRegistry; import org.hibernate.dialect.function.SQLFunctionRegistry;
import org.hibernate.engine.FilterDefinition; import org.hibernate.engine.FilterDefinition;

View File

@ -27,7 +27,7 @@ import org.hibernate.HibernateException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.context.ThreadLocalSessionContext; import org.hibernate.context.internal.ThreadLocalSessionContext;
import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.transaction.spi.LocalStatus; import org.hibernate.engine.transaction.spi.LocalStatus;