Click here to Skip to main content
15,846,038 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello there ,

Im going to do project in NHibernate technology.Can you tell me what is NHibernate ? and why we prefer Nhibernate ? What is its purpose ?
im confusing with SQL Queries on NHibernate . So can you people explain briefly about session factory etc in NHibernate .

Also Can you give me sample project code

Thanks in Advance

wincy edwin
Posted
Comments
walterhevedeich 29-Apr-11 1:50am    
Have you searched google about this? Typing nhibernate in google will produce 1,870,000 results. I suggest you do your homework of reading first and start creating your code, and then post questions when you encounter problems.
Sergey Alexandrovich Kryukov 29-Apr-11 1:58am    
For this case, I have my standard advice, please see my answer.
--SA
walterhevedeich 29-Apr-11 2:25am    
Ahh.. the famous standard advice of SA. Yeah I've seen it somewhere before. Im giving it a 5. Perhaps you should give a name to it, something similar to RTFM for example? :)
Sergey Alexandrovich Kryukov 29-Apr-11 2:40am    
Thank you, Walter (excuse me, do I use correct name?)
Good idea, by the way -- thank you. I modify the text mocking the form of the question.

As to RTFM, Read The Following Manual :-) -- Microsoft Q209354:
http://radio-weblogs.com/0001263/junk/Q209354 - HOWTO.html
--SA
walterhevedeich 29-Apr-11 2:49am    
Your'e welcome, and, yes you are using the right name. Good job of giving a more decent meaning to RTFM. :)

The Question in not completely incorrect, but can be greatly improved. You should have re-formulated it:

"What are Wikipedia, Google, CodeProject and StackOverflow.com?"
If you asked and got good Answers, the Questions like your original one would not be needed!

—SA
 
Share this answer
 
Comments
Joan M 29-Apr-11 2:41am    
You've missed the pretty BING! :O

Nice standard answer... :-D
Sergey Alexandrovich Kryukov 29-Apr-11 2:48am    
Thank you, but Bing is still struggling to earn my credit.
--SA
Joan M 29-Apr-11 2:51am    
^^
i think you need this

Click[^]
 
Share this answer
 
Hope NHibernate Best Practices with ASP.NET, 1.2nd Ed.[^] article from CP might help you.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Apr-11 2:50am    
Good... practices, a 5.
--SA
[no name] 29-Apr-11 4:39am    
Thanks SAKryukov..
GO through the below link ..,

How Fire was invented?[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Apr-11 2:50am    
Ha-ha! Thank you for the snow! Get my 5.
--SA
Don Jomar Hombrebueno 30-Jun-11 9:22am    
i like this one!!!
"NHibernate is an ORM, or Object-Relational Mapper. In the same line as LINQ to SQL, Entity Framework, LLBLGen, and others, ORM tools remove most of the need to write stored procedures to handle common data access (CRUD) for your business objects. ORM tools require that you create (either manually or with a visual designer...depends on the one you choose) a mapping specification that traces which properties of your objects map to which columns of your tables and/or views in your database. When you need to retrieve objects, the ORM tool generates the appropriate SQL for you, and sends it to the database. When the time comes to update your objects, the ORM will not only create the SQL to insert, update, and delete for you...it will also batch those commands so that a single connection and batch of commands are sent to the database and performs the whole thing in a transaction. ORM tools can also improve the efficiency of your queries by allowing you to select entire object graphs in a single go, generating the most efficient SQL for the task.
With ORM tools, you still need to query, however you either with basic methods on the ORM's context or session object, or with a custom query language for that ORM. These days, most ORM's, including NHibernate, also provide LINQ support, allowing you to use standard LINQ syntax to query your object model, which in turn is translated to SQL queries against your database for you.
The benefit of OR mappers is that you centralize almost ALL of your code into your domain, rather than splitting it between domain and stored procs. You lighten the stored procedure load on your database, providing less of a barrier to refactoring your database if the need ever arises, providing greater business agility not only in your domain, but also with your database schema. Since you don't have to write SQL, and especially if you use LINQ, you can often create a more efficient application in less effort with lower long term maintenance costs.
Aside from the inevitable war with your DBA's (if you have them), OR mappers can bring considerable benefits to the table that can reduce implementation effort, improve maintainability, and provide greater business agility."


For Sample Application refre below link,
[^]

I Hope it will help you.
 
Share this answer
 
v3
Comments
itsmecoder 29-Apr-11 8:14am    
it saves me...thank you Pratik Bhesaniya
Don Jomar Hombrebueno 30-Jun-11 9:26am    
i appreciated this answer. thanks.
waqas_shabeer 29-Mar-12 18:07pm    
Very helpful answer. Thanks pratik

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900