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 Eclipse Persistence Services Project (EclipseLink) project's goal is to provide a complete persistence framework that is both comprehensive and universal. It will run in any Java environment and read and write objects to virtually any type of data source, including relational databases, XML, or EIS systems. EclipseLink will focus on providing leading edge support, including advanced feature extensions, for the dominant persistence standards for each target data source; Java Persistence API (JPA) for relational databases, Java Architecture for XML Binding (JAXB) for XML, J2EE Connector Architecture (JCA) for EIS and other types of legacy systems, and Service Data Objects (SDO).
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.
What is Ebean?
Ebean is a Object Relational Mapping Persistence Layer written in Java (Open Source LGPL license).
* Providing the features of EJB3's JPA (and more)
* No container required
* JPA compatible ORM mapping (@Entity, @OneToMany, ...)
Why use Ebean?
Ebean provides a simpler approach to Object Relational Mapping. It does this by not requiring session objects such as JPA EntityManager, JDO PersistenceManager, Hibernate Session, Toplink ClientSession.