And now ... Hibernate's JPA
So, with a bit of a hit and miss experience with OpenJPA after Toplink JPA, I decided to give Hibernate JPA (Hibernate Entity Manager) a go before going back to Toplink JPA with my tail between my legs. My initial reservation for trying out Hibernate's JPA implementation was mainly due to the rift between the Spring/Interface 21 people and the Hibernate/JBoss people. Whilst Hibernate and Spring have been and remain a fantastic combination, the bitter blood between the too camps can be a little intimidating. But... with another glowing article on using Spring and Hibernate JPA in combination, I set about my task.
Well, only and hour and a half later, and I can say that my faith in JPA has been restored, along with a nice bonus that I can remove any reference to a javaagent: Hibernate's implementation needs no sort of special run time weaver, which makes me wonder why the others do.
Looking back at my experiences with OpenJPA and Toplink, I'm willing to bet most of the pain I endured was due to the special weavers needed to run them on servlet containers like Tomcat. The special weavers bring out some very confusing bugs with IllegalAccessErrors, often quite deep in the Java reflection stack. So, depending on where you're going to be deploying to, I'd offer the following advice (with the proviso that this advice is only based on observations and not hard fact):
- lightweight servlet container like tomcat: maybe avoid OpenJPA and Toplink until the javaagent weavers are no longer necessary, try Hibernate (or Kodo if it's a commercial application)
- EJB 3 container: The weaver concerns do not apply, OpenJPA and Toplink should be fine in these environments
0 comments:
Post a Comment