Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1
Hi Guys,
I am currently a beginner to Hibernate and am in the process of learning. I have MyEclipse which does do reverse engineering which is nice but I want to learn how this product works by coding it myself. I have created the hibernate.cfg.xml file in the root directory and created my persistent class with its mapping billing.hbm.xml in the same directory. The mapping file in mapped to the configuration file. Everytime I call:
SessionFactory sessionFactory = configuration.buildSessionFactory();
I get the following exception:
Exception in thread "main" org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:378)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
at com.hibernatedemo.test.HibernateReadTest.main(HibernateReadTest.java:26)
The dialect is set in my cfg file:
<hibernate-configuration>
<session-factory>
<property name="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/skylite
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="myeclipse.connection.profile">MySQL</property>
<property name="connection.password">password</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="max_fetch_depth">1</property>
<mapping resource="com/hibernatedemo/test/EchoMessage.hbm.xml" />
<mapping
resource="com/hibernatedemo/inheretencetest/Billing.hbm.xml" />
</session-factory>
</hibernate-configuration>
I do not understand what I am doing wrong?
Thanks and Regards