0

So I am very new to web development and working on a new project that will make use of Nhibernate as my ORM and MySql database.

I wanted to set it up so that NHibernate would create my database table based on the (all necessary NHibernate files). So far I have concluded that NHibernate will generate the DB schema that I have laid out with the mappings and class files.

The problem I am seeing is that it appears that you must have the database in place in MySql first for NHibernate to create the table (understood). However, when reviewing creating a MySql database in the manual it is requiring you to specify the schema with the create command.

So far the number of blogs I have read concentrate on what you need for NHibernate and not much details in correctly prepping your MySql server.

Any direction or advise is greatly appreciated.

1 Answer 1

1

You need to run the "create database [databasename];" command before building up your schema. You don't neeed to specify a schema to use this command.

Sign up to request clarification or add additional context in comments.

2 Comments

is it required to specify your properties in the persistent class as "virtual".
Nhibernate creates proxies from your classes and to do so it needs to overrride the properties in your classes. Therefore, your properties must be virtual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.