| Author |
runtime exception getting when i execute hibernate program
|
ramu ta
Greenhorn
Joined: Feb 06, 2011
Posts: 18
|
|
hi i tried to execute some sample hibernate program.
"Exception in thread "main" org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect."
this is the error i am getting...
i am using mysql database.
please help me
|
 |
ramu ta
Greenhorn
Joined: Feb 06, 2011
Posts: 18
|
|
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/mysql</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">XXX</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="Account.hbm.xml"/>
</session-factory>
</hibernate-configuration>
----------------------------------------------
this is my hibernate.cfg.xml file
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
You've defined a property called "dialect". Hibernate requires a property called "hibernate.dialect".
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
ramu ta
Greenhorn
Joined: Feb 06, 2011
Posts: 18
|
|
even though i made it as hibernate.dialect same error i am getting...
both xml files also i placed in the same folder as the program resides. but still getting the same error.
i am running this program in eclipse. i think may be problem will be in classpath. will you please tell me what are the all jars i should place in build path?
"entity program(Account.java)" and application program(AccountTest.java), both i placed in "com.sample" package. both Account.hbm.xml and hibernate.cfg.xml, i placed in the same package.
this is the situation.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Exactly the same exception after you have changed this property? Sounds like you are maybe not using the configuration file you think you are.
I can't tell you what Jars are required without knowing which version of Hibernate you are using, though the Hibernate documentation can. Missing Jars cause NoClassDefFOund errors - are you getting any of those?
For Hibernate 3.6.1 you need all the jars in the lib/required folder of the distribution, plus hibernate itself.
|
 |
 |
|
|
subject: runtime exception getting when i execute hibernate program
|
|
|