Comparison with nHibernate

Posts   
 
    
Truistic
User
Posts: 4
Joined: 09-Nov-2005
# Posted on: 08-Mar-2006 17:28:46   

Ok, before anyone begins to flame, I'm a rightful owner of LLBLGen Pro (purchased in November of 2005) and I've already done many searches on the forums and read Frans' blog on ORM ideology. Disclaimer: While I've used LLBLGen in R&D in preparation for our next product, I haven't done a full blown project with it yet (or any other ORM).

I have a customer who is wanting to use nHibernate, but after investigating it, it seems to me that there is a fundamental difference in ORM ideology that I just can't put my finger on. Add to that the fact that you have to hand code the XML mapping files. On the other hand, there seems to be some advanced mapping techniques possible in nHibernate that don't seem to be possible with LLBLGen.

I'm not trying to make the case for nHib, I'm really trying to make the case for LLBLGen. Does anyone have some free time to elaborate on the differences in modeling techniques between the two and the advantages of using LLBLGen over nHib?

edit: Yes, it is supposed to be NHibernate...my bad.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 08-Mar-2006 19:11:33   

I'm not aware of a mapping technique you can't do in LLBLGen Pro or it must be a cornercase you probably won't run into.

The main fundamental differences are: - LLBLGen Pro is based on the philosophy that the concept of an 'Entity' is defined in an abstract relational model (which is normally the case) and it therefore reverse engineers that model back into entities in the project; nhibernate is based on the philosophy that the concept of an 'entity' is defined in a class model.

  • LLBLGen Pro uses base classes with code which are used by the entity classes. nhibernate doesn't use base classes, it maps your own classes (so you have to write these) to database tables. So what you get for free with llblgen pro entities, you have to write yourself with nhibernate.
Frans Bouma | Lead developer LLBLGen Pro
Truistic
User
Posts: 4
Joined: 09-Nov-2005
# Posted on: 08-Mar-2006 21:25:30   

So it is really just a philosophical design difference between the two?

LLBLGen comes from a database perspective where you already have a database set in stone (but can obviously be updated and the code regenerated).

NHibernate comes from an OO perspective which says you should be able to write all working code and test it before even having a database.

And this doesn't mean that one is necessarily more right than the other, just different perspectives of design.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 08-Mar-2006 23:11:39   

exactly. There's no right or wrong, just different points of view on the same problem and from there, different solutions for that problem. Each point of view and thus solution has pro's and con's and you should select your solution on the list of pro's and con's in the context of your project AND how YOU look at it, thus which approach matches most with your point of view on the problem.

Frans Bouma | Lead developer LLBLGen Pro
pilotboba
User
Posts: 434
Joined: 05-Aug-2005
# Posted on: 08-Mar-2006 23:31:13   

Truistic wrote:

I have a customer who is wanting to use nHibernate, but after investigating it, it seems to me that there is a fundamental difference in ORM ideology that I just can't put my finger on. Add to that the fact that you have to hand code the XML mapping files. On the other hand, there seems to be some advanced mapping techniques possible in nHibernate that don't seem to be possible with LLBLGen.

Yes, they take different approches. The main one is, that LLBLGen favors data modeling and extending your datamodel into the middle tier. NHibernate favors object modeling, then mapping your object (domain) model onto your database.

There are several tools that allow you to generate NHibernate domain model and mappings from your data model, a la llblgen. See MyGeneration, Codus, Codesmith. There are also several tools that allow you to generate a schema from a domain model and mappings. See PuzzleFramework.Net, and AndrMDA, etc. There are also some Java tools that can be used.

NNibernate puts ALL of the mapping in the XML, where with LLBLGen you have to specify some of the mapping in your code, such as JoinPaths.

Truistic wrote:

I'm not trying to make the case for nHib, I'm really trying to make the case for LLBLGen. Does anyone have some free time to elaborate on the differences in modeling techniques between the two and the advantages of using LLBLGen over nHib?

I'm not gonna go there, they are both capable tools that can get the job done.

The one advantage LLBLGen has over NHibernate is Fran's. He has an awesome comittment to support... support both in answering questions and fixing bugs... you are not going to get that level of support for NHibernate unless you hire someone, or become and expert at it, including knowing the code. This may be enough to tip the scales to LLBLGen for you.

BOb

Answer
User
Posts: 363
Joined: 28-Jun-2004
# Posted on: 09-Mar-2006 04:00:04   

i tried nhibernate out for a while, its cool, but it can be a real pain in the ass let me tell ya...

it does have advantages, but personally the making of the xml files got to be real tedious, and the biggest problem i had, was in order to do complex queries you had to have your xml files setup properly, and im not real good at SQL, so it took me quite a while to figure out how to use HSQL, with llblgen since everything is typed its a breeze. 5 minutes of looking in the llblgen manual, 2.5 hours with HSQL. With llblgen i ALMOST dont even have to think about SQL, its wonderful simple_smile

nHibernate really needs a designer to autogenerate classes and do the xml mappings for you and that also integrates hsql testing into the ide would be ideal...