Question: What is the difference between `org.hibernate.context.JTASessionContext` and `org.hibernate.context.ThreadLocalSessionContex`?

Answer: 
With `ThreadLocalSessionContext`, the current session (`sessionFactory.getCurrentSession()`) is created and stored in a `ThreadLocal`. This works in any environment, because `ThreadLocal` is JavaSE.

JTASessionContext binds the current session to a JTA transaction. The JTA transaction provides a hook for cleanup, unlike the thread local. This is available in environments that have JTA, such as an application server.

This all is explained in the javadocs of the two classes.
[here](http://docs.jboss.org/hibernate/core/3.5/api/org/hibernate/context/JTASessionContext.html) and [here](http://docs.jboss.org/hibernate/core/3.5/api/org/hibernate/context/ThreadLocalSessionContext.html)
These strategies control behaviour of `SessionFactory.getCurrentSession()` by defining the scope of the current session.

* `JTASessionContext` associates current session with the current JTA transaction and closes it at the end of JTA transaction. This strategy is used in JTA-capable environments, i.e. in application servers.
* `ThreadLocalSessionContext` associates current session with the current thread and closes it at the end of transaction created in that session. It's for use in standalone environments.

By the way, javadoc and reference describe it pretty clear.

**See also:**

* [2.3. Contextual sessions](http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/architecture.html#architecture-current-session)
* [JTASessionContext](http://docs.jboss.org/hibernate/core/3.5/api/org/hibernate/context/JTASessionContext.html)
* [ThreadLocalSessionContext](http://docs.jboss.org/hibernate/core/3.5/api/org/hibernate/context/ThreadLocalSessionContext.html)