Home >

NHibernate hbm2ddl

23. November 2008

NHibernate has a number of configuration options: Enabling statistics, Caching etc. You can check more from here

I will now talk about an unknown feature(well, at least I didn’t know until I implement SchemaValidator): hbm2ddl.auto

Hbm2ddl.auto is declarative way to use SchemaExport / SchemaUpdate / SchemaValidator (well the latter sounds odd, maybe it would be better to call it SchemaValidate, what do you think?). If you add

<property name="hbm2ddl.auto">create</property>

for example, it will run

new SchemaExport(cfg).Create(false, true);

during SessionFactory initialization, with which you probably are familiar.

There are several options for hbm2ddl.auto.

  1. update executes SchemaUpdate which will modify your existing table with new mapping, without dropping any columns.
  2. create-drop executes SchemaExport when SessionFactory initializes and drops the schema at the end of the life of the factory.
  3. validate executes SchemaValidator which I blogged about here

If you prefer not to use programatic way, configuration is just here.

kick it on DotNetKicks.com

Comments

11/23/2008 1:52:34 PM #
Trackback from DotNetKicks.com

NHibernate hbm2ddl
12/19/2008 4:42:20 AM #
Pingback from blog.caraulean.com

NHibernate’s niceties: hbm2ddl auto mode in unit tests « Valeriu Caraulean - Building Software
1/6/2010 5:20:51 PM #
How Dovetail uses StructureMap with NHibernate

A quick note here, this article shows features of StructureMap that are only available in the very latest
9/15/2010 10:55:46 PM #
Thanks for the code.
9/20/2010 8:29:00 PM #
Increase your productivity not only because they generate ...
9/25/2010 2:04:34 PM #
The term "weblog" has been around since 1997 when it was coined by American blogger ...
9/28/2010 3:29:04 PM #
Looks like a good code,
<property name="hbm2ddl.auto">create</property>

I will try it
10/8/2010 7:58:18 AM #
I agree with your thought.Thank you for your sharing.
11/20/2010 4:00:14 AM #
Hello People! Your blog is awesome! I would like to visit it everyday. It's very informative and amazing
eee
eee
11/24/2010 3:23:28 PM #
Very good article, well written and very thought out. I am looking forward to reading more of your posts in the future.

12/13/2010 9:46:47 PM #
shop http://www.medexsupply.com/WelchAllyn-x_mid-53.htm wor all of your Welch Allyn products
12/14/2010 4:08:05 PM #
hi! its looks great here in your site,.  you give many information here thanks a lot,. i learn a lot here....

www.cssdrive.com/.../
www.conceptart.org/forums/member.php?u=263041
share.food.com/.../style.esi?userid=41816309
http://www.redbubble.com/people/femalekerr
renanorola.i.ph/.../
12/15/2010 5:32:45 AM #
We are also very happy to now offer web hosting services, regardless of whether or not you want us to build you a website;
There’s no need to go scouring the net for a great web hosting service to compliment your new site…
GFsoul does web hosting and takes care of all the important details like domain name registration.
Our design and hosting services perfectly compliment each other; we are offering customers true “one-stop shopping” experience, and at extremely affordable prices. You won’t find customized web design and hosting at these amazingly low prices anywhere buy here.
Our web hosting services features all of the same appointments that other (better known) web hosting services can offer you, but with lots of great tech support, customization and a lower overall cost.
12/19/2010 10:33:38 AM #
Fantastic work! This is the type of stuff that should be all around the web. Shame on the search engines for not positioning this post higher! By doing so your blog becomes more appealing and interesting for your audience but in terms of SEO and search engines they love a fresh updating blog site.
12/20/2010 1:53:14 PM #
I agree with your thought
12/21/2010 7:44:18 PM #
Could I put this post on my page if I gave you credit + a link?
1/10/2011 3:53:26 AM #
cool post1 thanks for the share.
1/12/2011 8:00:26 AM #
I suggest this site to my friends so it could be useful & informative for them also. Great effort.
1/13/2011 11:17:09 AM #
Diamonds, best friend is a woman.
<a href="http://www.ukthomasabo.com/">thomas sabo uk</a> Classic Hollywood blonde already understand, the world nothing more sexy than diamonds, more luxurious and, of course, its wear otherwise. Thus,
<a href="http://www.ukthomasabo.com/">thomas sabo uk</a>through the season\u0026#39;s new design, so that days, other than the President celebrities
<a href="http://www.ukthomasabo.com/">thomas sabo uk</a>and aristocrats can enjoy the excitement and pleasure of diamonds.
2/23/2011 2:51:29 PM #
Hi, I found your post really helpful. It helped me all the way in completing my assignment, I am also giving a referance link of your blog in my case study. Thanks for posting such informative content. Keep posting.
2/24/2011 2:01:45 AM #
Great update about NHibernate. I was figuring this issue regarding this and just overcame it by reading your post. Thanks!
2/25/2011 2:21:54 PM #
It’s amazing,thanks for sharing these useful information! I like this information sharing by you very clear, just explain and also great informative post.I am Waiting for the next post....
3/21/2011 12:33:06 PM #
Blogroll links aint that great Tong but i am not the admin… Tong … Just Telling Tong Laughing
3/22/2011 2:27:13 PM #
This is probably one of the best mentions of this topic I've seen in quite a while. It's obvious that your knowledge of the subject is deep and this made for a very interesting read.
3/22/2011 10:56:06 PM #
Undeniably believe that which you said. Your favorite justification seemed to be on the net the easiest thing to be aware of. I say to you, I certainly get irked while people think about worries that they just don't know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side-effects , people could take a signal. Will likely be back to get more. Thanks
3/22/2011 11:21:38 PM #
Very interesting entry, I look forward to the next! Thx for share
3/23/2011 12:23:43 AM #
Very nice post. I just stumbled upon your blog and wished to say that I've really enjoyed surfing around your blog posts. In any case I will be subscribing to your rss feed and I hope you write again very soon!
3/23/2011 11:34:43 AM #
Come on dude, these facts* and proof* i mean who is posting* lol Tong
3/23/2011 3:02:35 PM #
ohh…nice post but really?/? Tong
3/23/2011 3:14:49 PM #
Great articles & Nice a site….
3/23/2011 4:29:14 PM #
thanks !! very helpful post!
Comments are closed