Jump to content
xisto Community
Sign in to follow this  
k_nitin_r

Comparing The Java And .net 'flavors' Of (N)Hibernate How different are Hibernate and NHibernate?

Recommended Posts

Hi!I'm not sure if I should be posting this in the .NET forum or the Java forum, but since I was inspired to write this post after having used the Java flavor of Hibernate, which I used after trying out the .NET port of Hibernate (called NHibernate), I'll make this post here in the Java forum.I have used the .NET port of the Hibernate ORM library, called NHibernate, and later had a go at using the Hibernate library on Java. Moving between the two was simple because NHibernate is simply a port of the Hibernate library. There are some differences that I did experience. When using NHibernate, the first instinct that I had was to switch to a third party data access layer provider due to the need to write XML configuration for the mapping files. The requirement of mapping the files was just too burdensome. Later, I discovered Fluence (or is it Fluent?), which automatically maps the entity classes to their respective tables through the class names. It took away a part of the onerous task that really bothered me and writing the entity class was not too much of a bother because I wanted to add in the NDoc style comments for generating documentation for the class members. After getting into Java development and having a go at using Hibernate, I found the use of Hibernate's equivalent to be more IDE based, with the capability to automatically reverse engineer the database and create the Hibernate mapping files and the entity classes. There are third party utilities that do create the entity classes for NHibernate too, but it is not common practice because the tools have not enjoyed wide adoption within the .NET development communities.The differences experienced between the two different Hibernate 'flavors' were of the supporting libraries and the kind of automation that builds on top. The Fluence/Fluent library adds runtime support for mapping, while the Java IDE (the ubiquitous Eclipse, or Oracle's own NetBeans) tools take over the work and place it into the generated source code, which may improve runtime performance. I believe both flavors of Hibernate use the Log4Net (for NHibernate) / Log4J (for Hibernate) libraries so the configuration of the logging messages is similar too. There is the option to have the logging code excluded from the source code, since both projects are open source, but it is desirable to leave the logging code in to be able to troubleshoot any problems that might not seem apparent.With projects such as the iKvm, the Java and .NET worlds may not seem like two distinct entities and they just might co-exist. They already share a common set of libraries - the ones that made it big on the Java platform have been ported across to the .NET platform - and they share a similar architecture. It probably will not be long before organizations reduce their costs in integrating their investments on the Java and the .NET platforms to unify their information assets.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.