Hibernate and TopLink

I've had a lot of trouble using TopLink with Tomcat. Most of the problems appeared to be related to foreign keys and reverse-engineering but, looking deeper, were caused by 'weavers' and classloading. TopLink intercepts calls to POJOs by generating dynamic proxy code then weave them by playing switcheroo at classloader level. This technique apparently has some conflicts with Tomcat's own way of loading classes, conflicts that I spent many hours chasing and resolving only to face more later before giving up. I haven't used OpenJPA but I've read elsewhere that it's even worse. I am sure they'll improve but, for now, stay way.

After giving up on TopLink, I tried Hibernate 3.3 and, despite a lot of initial head scratching, I am happy to report that it worked well without even a single problem. Hibernate's two downsides are that it needs a lot of third-party jars to get it working and that it's rather slow. But then I couldn't go far enough along with TopLink to even test performance so the downsides are bearable. I can always rewrite the DAO layer later using iBATIS or use JDBC directly. For now, ease of development matters the most.

Advertisements