Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 204233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:26:57+00:00 2026-05-11T17:26:57+00:00

Making my first steps with NHibernate, I’m trying to have it creating my Tables

  • 0

Making my first steps with NHibernate, I’m trying to have it creating my Tables automatically from the hbm files. The database backend is SQL Server 2008 Developer Edition.

This is the common sample code I see in NHibernate Tutorials:

var cfg = new Configuration();
cfg.Configure();
cfg.AddAssembly(typeof(Posting).Assembly);
new SchemaExport(cfg).Execute(false,true,false,false);

Sadly, this does not work. I have set show_sql to true, and it does not print out any statement. Looking at SQL profiler I see my Application connecting to the DB, but then doing nothing.

I can fix that by changing the first parameter (“script”) to true:

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

I don’t understand why. The parameters of SchemaExport are sadly not really explained (also not the difference between .Create and .Execute), and I would like to find out what this parameter does, and why it’s not needed i.e. when using SQL Compact Edition (that works also when script is false)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:26:57+00:00Added an answer on May 11, 2026 at 5:26 pm

    The SchemaExport is part of the Hbm2Ddl utility which is really separate from NHibernate functionality. It does not use “show_sql” which is used while NHibernate is running only.

    To get a copy of the schema you create you use .SetOutputFile(filename)

    This is the method I use when I wish to create a new database.
    I get a formatted schema in MyDDL.sql file and the database is built from the schema:

     private void BuildSchema(Configuration config)
     {
    
            new SchemaExport(config)
                .SetOutputFile(_fileName + "MyDDL.sql")
                .Execute(true /*script*/, true /*export to db*/,
                         false /*just drop*/, true /*format schema*/);
     }
    

    SchemaExport.Create is just a shortcut to Schema.Execute with the just drop false and format true.

    public void Create(bool script, bool export)
        {
            Execute(script, export, false, true);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to migrate a database from Sybase to MySQL. This is
I'm trying to learn lisp and as i'm making my first steps i got
I'm making my first baby steps with unit testing and have written (among others)
I'm making some first steps in Typo3 and am currently trying to make a
I'm making my first steps with django, at the moment im trying to apply
I am making my first tentative steps into MVC3 and have come across an
Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
I'm making my first steps with unit testing and am unsure about two paradigms
This problem is making me crazy. Actually I have multiple problems. First one: Why
I'm making my first steps with JPA (eclipselink) developement, and i'm wondering if there's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.