When using spring and spring managed transactions never mess around with the hibernate.current_session_context_class property UNLESS you are using JTA.
Current we support:
Hibernate 3.1
Java Persistence API (sometimes called JPA or EJB3 persistence)
Db4Objects (a lightweight object database)
It works inside a Java EE container, inside a plain Servlet environment or in a purely SE environment such as a desktop application (with obvious limitations--cant use session-per-http-request strategy outside a servlet environment for instance
Spring, JPA, and JTA with Hibernate and JOTM
2007-04-24 20:35
have been struggling for a couple of hours today to modify a Spring JPA configuration with a single datasource, Hibernate as the JPA provider and the JpaTransactionManager to a configuration with two XA datasources, Hibernate as the JPA provider, and the JtaTransactionManager with JOTM as the standalone JTA provider.
since the Spring and Hibernate reference manual and Javadoc documentation merely contain a number of hints on how to configure JPA with a JTA transaction manager and others are struggling as well i decided to post how i finally got it to work.
The Envers project aims to enable easy versioning of persistent JPA classes. All that you have to do is annotate your persistent class or some of its properties, that you want to version, with @Versioned. For each versioned entity, a table will be created, which will hold the history of changes made to the entity. You can then retrieve and query historical data without much effort.
Similarly to Subversion, the library has a concept of revisions. Basically, one transaction commit is one revision (unless the transaction didn't modify any versioned entities). As the revisions are global, having a revision number, you can query for various entities at that revision, retrieving a (partial) view of the database at that revision.
This first tutorial gets your feet wet setting up a persistent unit, creating in-memory entities and persisting those entities to a database. We let the environment create our database schema based on meta-information (annotations) in our entity classes.
In the perfect world, your object model would map seamlessly to your database schema. Most organizations however, have database naming standards, requirements for how relationships are modeled and columns that all tables must have.
Apache MyFaces Orchestra aims to provide a simple way to combine a web-framework with a persistence layer. Typically, an Apache MyFaces Orchestra stack might combine JavaServer Faces, Spring and a JPA implementation like Toplink, Hibernate, etc.
The underlying idea is to provide long persistence sessions to the web-developer - this is done by associating these sessions with a conversational context.
The conversational context is opened when the bean configured for this context is first loaded. It can be manually closed by the programmer, plus a time-out can be configured as a global parameter.