The dialect was not set

Hi, I have an ERD diagram, and I am trying to generate a C# library to be used in an application. It uses MySQL.

All the process is ok, except, if I use a form to do any changes to the DB, I get the exception: "The dialect was not set. Set the property hibernate.dialect."
in the folowing row:

 	private DataStoragePersistentManager() : base(_connectionSetting, _sessionType) {

Can anyone tell me how to try to get rid of this, or that another information may help? P.S. in the xml file the dialect is set…

Hi ik,

Please make sure the mapping XML file (xxxx.cfg.xml) is put correct. It should either embed in the dll/exe or place in working directory.

Best regards,

Oh, thanks, I have found my mistake. Sorry to take your time :wink:

I had this same problem as well. The solution for this is on page 2-11 (Step 14) of the DB-VA Programmer’s Guide for .NET. A better solution than copying it manually would be:


  1. Copy it to the project directory
  2. App -> Project -> Add -> Existing Item
  3. Select “hibernate.cfg.xml”
  4. In “hibernate.cfg.xml” properties
    a. change Build Action to "None"
    b. change Copy to Output Directory to “Always”

Embedding the hibernate.cfg.xml as a resource did not work for me in Visual Studio 2005.


Actually, I just updated my db schema, and realized that the .xml file didn’t update. Adding a line like this to the post-build step is the best way to go:

 copy $(SolutionDir)..\VisualParadigm\src\hibernate.cfg.xml $(TargetDir)