VaR configuration = new NH. cfg. configuration ();
Configuration. Configure (recovery path );
After the configuration object is created, you need to call the configure () method to load the configuration file. Hibernate is in the app by default. config and web. you can also specify the location of the configuration file, which is usually setProgramOutput directory (BIN) under"Hibernate. cfg. xml"File.
Program Configuration
VaR configuration = new NH. cfg. configuration ();
Configuration. setproperty ("connection. provider", "nhib.pdf. Connection. driverconnectionprovider ");
Configuration. setproperty ("dialect", dialect );
Configuration. setproperty ("connection. driver_class", driver );
Configuration. setproperty ("connection. connection_string", connectionstring );
Configuration. setproperty ("connection. release_mode", "on_close ");
Configuration. setproperty ("show_ SQL", "true ");
Configuration. addassembly ("com. XXX ");
Configuration. addassembly ("com. yyy ");
Configuration. addassembly ("com. Zzz ");
After the configuration object is created, you do not need to call the configure () method.