-->
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.  [ 2 posts ] 
Author Message
 Post subject: nHibernate Support for creation of CRUD Code
PostPosted: Sun Sep 24, 2006 12:36 pm 
Newbie

Joined: Sun Sep 24, 2006 6:22 am
Posts: 2
Hi,

I am using nHibernate as ORM tool. I am just curious to know if nHibernate tools generates code for CRUD operations. As per my current understanding, We need to wirte the CRUD operations by hand.
I am looking for a tool in nHibernate that could generate Code for Save,update and delete.

I am using mygeneration tool to generate business entities and mapping xml files from database schema.

Currently, I need to write Session.Save() etc manually.

Please let me know If nHibernate or any other tools in nHibernate family,can provide me the code for CRUD operation as well. This would be of great help to me and my project.

Regards,
~Nilesh


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 25, 2006 2:30 am 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
There are a couple of ways for this (and more). One, you can create a generic Data Access Object (DAO) class and have one for each persisted entity (or as needed).
If you are applying Domain Driven Design principles, you would be using a Repository to access your database and this would be further simplified by the notion of Aggregates. Then you can have a generic Repository<T> (if you are using .NET 2.0 that generalizes all your CRUD functions.

Check out the Hibernate in Action book for their thoughts on access to the ORM and also check out http://www.codeproject.com/aspnet/NHibernateBestPractices.asp for a decent example of a DAO.
Swing by domaindrivendesign.org for DDD stuff, too.

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.