These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: considering using nHibernate
PostPosted: Wed Feb 11, 2009 4:14 pm 
Newbie

Joined: Wed Feb 11, 2009 4:06 pm
Posts: 4
I'm considering using Hibernate but I'm a bit confused by something. The documentation all assumes I know what Hibernate is and how it's designed. This is a real blind spot in your documentation.

It looks like Hibernate binaries are included with an application I develop. Why is nHibernate code included in my application?

The database schema is fixed and will not be changed at run time. Shouldn't it generate source code which I then compile? Is it loading, parsing the xml object to database mapping, and generating queries dynamically each time my application runs? This would be horribly inefficient since this only needs to be done once and will never change.

The docs speak about caching data and lazy writes. Is this going to work in a multiuser database?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 4:38 am 
Beginner
Beginner

Joined: Sat Jan 26, 2008 6:33 am
Posts: 24
Hello!

I might not be perfect to answer some of your questions, but that seldomly stops me :)

You should not have to care how NHibernate is internally designed, you just should know what it is for and how you use it. Generally it is "only" for mapping relational data to object instances in memory. With tools its also able to automatically update your db-schema or even generate code.

Technically it is just a tool to cut down development time. Its as always a trade between comfy programming and performance. So if you have lots of time and costs dont matter, you are more performant with direct queries on stored procedures. But consider, generating the queries themselfes is not the bottelneck of this system. Transforming the results to object instances is much more time consuming.

I for myselfe like it very much, to just edit some mapping document together with the classes and have the structure automatically updated with one line of code. As for multiuser environments, this also depends on the DB youre going to use. I developed my Business Layer in a way, that the cache is flushed on every save. So the biggest multiuser issue is anyways allways recognizing changes of other users.

Greetings!
Zorgoban


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 9:11 am 
Newbie

Joined: Wed Feb 11, 2009 4:06 pm
Posts: 4
Zorgoban wrote:
You should not have to care how NHibernate is internally designed, you just should know what it is for and how you use it.
Zorgoban


Ugh. Sorry to be disagreeable, but this is wrong on many levels. I really care about the quality of what I produce. I don't just slap stuff together without understanding how it works and picking the right tool for the job.

Zorgoban wrote:
Hello!
Technically it is just a tool to cut down development time. Its as always a trade between comfy programming and performance. So if you have lots of time and costs dont matter, you are more performant with direct queries on stored procedures. But consider, generating the queries themselfes is not the bottelneck of this system. Transforming the results to object instances is much more time consuming.
Zorgoban


I don't think the costs are terribly high to write sql statements. Even if it were high I could probably find a code generator or use serialization in .NET.

Thanks for taking out the time to help. :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 9:29 am 
Beginner
Beginner

Joined: Sat Jan 26, 2008 6:33 am
Posts: 24
Quote:
Ugh. Sorry to be disagreeable, but this is wrong on many levels. I really care about the quality of what I produce. I don't just slap stuff together without understanding how it works and picking the right tool for the job.


I understand your quality standard, but when it comes to using a 3rd party product, you naturally end up in trusting the quality of the product when it meets all your requirements without knowing each single line of sourcecode.

Quote:
I don't think the costs are terribly high to write sql statements. Even if it were high I could probably find a code generator or use serialization in .NET.


NHibernate is not a sql-generator, nor is a sql-generator equivalent to what NHibernate does. Its about getting data out of the db into objects that will contain logic to work with in the bussines layer. you dont get that without effort when working with data sets.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 12, 2009 10:51 am 
Newbie

Joined: Wed Feb 11, 2009 4:06 pm
Posts: 4
Zorgoban wrote:
Quote:
NHibernate is not a sql-generator, nor is a sql-generator equivalent to what NHibernate does. Its about getting data out of the db into objects that will contain logic to work with in the bussines layer. you dont get that without effort when working with data sets.


So how is what nHibernate does different than writing code to persist objects and a business layer to contain the application logic?

My problem is seeing why I need hibernate code at RUN time. I don't change databases, the database structure doesn't change, and my objects that model it don't change. Why isn't this just static code? What's the advantage I gain by having Hibernate code in exchange for the extra performance I pay for running that code?

It seems like this tool is something that makes the development easier at the expense of application size and performance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.