• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

runtime exception getting when i execute hibernate program

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<?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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've defined a property called "dialect". Hibernate requires a property called "hibernate.dialect".
 
ramu ta
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Tell me how it all turns out. Here is a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic