Note: Make sure with the data type used in the table in database, class file and the property name here used are case-sensitive. For example: salary defined in class file or database must have the same name here. Salary is itself wrong. You may get ADOException Unhandled or Column Mismatch Exception. Mention the database table name correctly, if you used it with schema. The <generator class = “assigned”> or <generator class = “identity”> can be used. Both may have different effects based on the constraints you set to the attributes.

Make sure that “testcust.hbm.xml” file's property of Build Action is selected as Embedded Resources (default is none or compile). You may get Mapping Exception of entity or class due to this, if not selected.

Save this VB.NET Project properly and Run it.

You can also use “hibernate.cfg.xml” instead of “app.config”. The coding for that is: