Session 5: Spring + JPA integration
[Rod Johnson]
(Rod Johnson sounds just like the 'dead ringers' version of Rolf Harris, which makes it harder than it should be to take seriously :–))
Why
– make it possible to switch providers – plug the gaps in the spec
– make it simpler to use JPA
– will be the main focus of Spring's ORM support, going forwards
How
– instrumentation of classes – either done at compile–time or at load–time; load–time is a big performance hit; compile–time is a pain for testing. Spring 2 has a LoadTimeWeaver which is class–loader scoped, either using it's own custom classloader, or ussing weaving capabilities from Oc4J, Resin, or Weblogic where available.
– Custom EntityManagerFactories – Local and Container contracts . Since spring is doing all of the container's work, it makes testing very straightforward.
– JPAVendorAdapter and JPADialect to facade away the bits outside the spec
– spring injection of EntityManager, or JPA–style injection, or JPATemplate
– Exception Translation either through JPATemplate or via AOP, if you mark up your code as @Repository (== 'class is a DAO')
– AbstractJPATest – super–easy–to–use test superclass for JPA integration testing
When
– right now (spring 2.0)
– spring 2.1 – leverage load–time weaving, add criteria API abstraction, other cool stuff
Add a comment
You are not allowed to comment on this entry as it has restricted commenting permissions.