Thursday, 25 December 2014

Getting Error : Could not parse configuration: /hibernate.cfg.xml



I'm trying out Hibernate with a simple java application and getting an error:



Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml



Here is my hibernate.cfg.xml:



<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://ift.tt/1fnOghG">

<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/hibernatedb</property>
<property name="connection.username">admin</property>
<property name="connection.password">admin</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop the existing tables and create new one -->
<property name="hbm2ddl.auto">create</property>

<!-- All the model classes along with their package name -->
<mapping class="com.techflakes.hibernate.Car"/>

</session-factory>
</hibernate-configuration>


Can someone help me to find what is wrong with my hibernate configuration file?


No comments:

Post a Comment