JSR 317: JavaTM Persistence 2.0 (JPA 2.0) is s a POJO persistence API for object/relational mapping. It contains a full object/relational mapping specification supporting the use of Java language metadata annotations (and/or XML descriptors) to define the mapping between Java objects and a relational database.
The definition of persistent entities, relations, interceptors etc. is annotation based (if you do not use the XML descriptors). Only dependent from the standard package javax.persistence . This allows to choose different JPA implementations/providers like:
All of them do provide additional rich feature enhancements like PostGIS syntax, compile time entity enhancement, plug-able extensibility etc.
JPAExtension does provide
- a Scala interface to the base JPA classes EntityManager, EntityMangerFactory, Query etc. to ease their usage
- Transaction scope and query wrapper to mesh better with Scala’s FP
- more type safe interface using Scala’s type system
- externalized query and filter class definition (dedicated XML file)
- Query parameter holder classes for type safe binding
I know that the most challenging thing is to provide working Scala implementations (suitable for Java Reflection API’s expectations). I will try to collect as many examples as possible for the common issues. (If you have one, contact me.)
The JPAExtension is available at Scala-Tools Maven Snapshot Repository
and it will be available at the Snapshot Documentation Site soon.
For now please visit the short blogposts (blog.fakod.eu/tag/jpa/ ) I wrote to get an impression of JPAExtension and Scala entities.
And as usual: Follow me on Twitter
To use JPAExtension simple put the following dependency in your pom.xml
</dependencies> <dependency> <groupId>org.scala-libs</groupId> <artifactId>jpaextension</artifactId> <version>0.0.2-SNAPSHOT</version> </dependency> </dependencies>
The JPA Extension should support
- more examples and test-cases
- enhance Filter Classes features (→ JDBCluster:CCFilter )
- Acegi integration
- Domain value check (→ JDBCluster: Domains) using Bean Validation )