Sunday, July 16, 2006

Hibernate 3 for JDK 1.3

In one of our projects, we are planning to use Hibernate the latest version of which is 3. Unfortunately we couldn't find the binary version of Hibernate 3 which runs on JRE 1.3 on JBoss as well as sourceforge site. We are using IBM WebSphere 5.0.2 which uses JRE 1.3, hence we couldn't use Hibernate 3. But we wanted to use some specific features of Hibernate 3 like one class getting mapped to multiple tables etc. So we thought we will compile the sources ourselves using JDK 1.3. We thought it was easy, but it wasn't.

Hibernate 3 was using some specific Java classes which are introduced in JDK 1.4 like EJBMethodPermission etc. We found most of these classes were used in org.hibernate.secure package. We thought we will ignore security for the time-being and removed the secure directory so that it is not compiled.

We hit the next problem, Hibernate 3 was using some methods related to updation of Clob, Blob, Ref, Array which are introduced in JDK 1.4. In our project, we are not using any of the above SQL data types, so its fine for us. But I was thinking, what if people want to use this version of Hibernate 3 and they want support for the above data types. I didn't [still don't] have an answer; I just kept thinking how were people doing without these methods being there. I am yet to find an answer for this.

After we commented the methods related to updation of LOB data types and secure package, Hibernate 3 happily compiled. We performed a few sanity checks, it seems to work fine at least for our required functionality.

Since we had modified/commented a few of the methods, we wanted to run a full round of JUnit tests bundled with Hibernate 3. We hit one more road-bock here, all the JUnit tests assumed JDK is 1.4. Now, we are working on resolving this.

In the mean time, we are going ahead with using our own version of Hibernate 3 [which I call Hibershop 3]. If anybody has compiled H3 with JDK 1.3 and using it successfully in their environment, it would be great if you could share the binary version with us. On the other hand, if you require JDK 1.3 version of H3, I can provide the one which we have built [with few limitations of course], please mail me at hanasim at gmail dot com.

No comments: