Towards harmony with Hibernate
Never thought that leaping into Hibernate1 could be a bit tricky at this time. First there aren't many good step-by-step guide to using Hibernate and secondly all the available ones, perhaps, don't hold good for Hibernate ver 2.01, though it was released almost 6 months back. Now the porting guidelines say that it isn't much of a work but a Hibernate newbie may beg to differ. As I said it is a bit tricky. Thanks to the post of Matt that helped me on this. Basically the code portion to use Hibernate would change as follows (hey, I am just a beginner on this so I might have said something stupid):
Earlier (assuming a database entity Player with a bean of similar name for persistance) :
[code lang=”java”]
Datastore dStore = Hibernate.createDatastore();
dStore .storeClass(Person.class);
SessionFactory sfactory = ds.buildSessionFactory();
[/code]
now:
[code lang=”java”]
Configuration cfg = new Configuration();
cfg .addClass(Person.class);
SessionFactory sfactory = cfg.buildSessionFactory();
[/code]
Now my application is hosted on Websphere Application Server (WAS) and connects to Oracle8 using JNDI datasource. I was able to talk to Oracle using Hibernate employing URL based connection but when it came to using JNDI datasource I was stuck. Posts at the Hibernate forum came with the usual replies and did not help much (may be my questions weren't good enough). As a matter of fact, I was getting the following error:
[code lang=”java”]
net.sf.hibernate.HibernateException: Could not find datasource: com.ibm.ejs.cm.JDBC1PhaseRF
[/code]
The solution had nothing to do with Hibernate. In fact WAS was getting confused by the javax.sql classes that came with the library jdbc2_0-stdext.jar. This jar arrives with the Hibernate distribution and collided with WAS's own settings. Once I removed this jar, the problem vanished and I could connect to Oracle using Hibernate. The related thread is here. I have managed this far but I know it will take sometime before I could be in perfect harmony with Hibernate.
Quick Resources:
- Nick Heudecker's article ( covers Hibernate 2.0.1)
- Glen Smith's Hitchhiker's Guide to Hibernate
- Hibernate – External Documentation List
1: Hibernate is an open-source object/relational persistence framework and query service for Java.
looks good!
Thanks to Arjun I found the motivation to correct my template a bit. Now the Blog looks good on IE6.0 and Mozilla Firebird as well (both on resolution of 1024 X 768. Unfortunaly the menu div is devastated in Firebird on 800 X 600 resolution while on the same resolution it looks good on IE6.0. Can’t say how the blog looks now on IE5.5 but I guess some compromises would have to be made.
Hmm I wonder how many people use 800×600 on IE 5.5 compared to Firebird. I would think the number would be greater for the latter. U’ll find most of the geeks using Firebird or RSS aggregator! My 2 cents
Might be so Arjun. Till few weeks back I never checked this blog on other browsers, it seemed perfectly OK on IE6 with 1024 X 768 resolution, then one day I had a look on IE5.5 on 800 X 600 and I was terrified; reson why I had to put the main and menu divs inside HTML tables. That atleast handles the IE browsers. Will try it on Firebird to know what u mean. Thanks 🙂
Your blog looks out of shape on Mozilla Firebird, u might wanna check it out!