This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can Any one help Hibernate.properties not found

 
ksrk mahidhar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i have run the basic hibernate sample that have been give in the net but its giving
Hibernate.properties not found

And i have double checked hibernate.cfg.xml nothing wrong in that

can any one help me how to resolve this issue

Configuration file is


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>

<session-factory>
<!-- properties -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/hibernate</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="show_sql">true</property>

<!-- mapping files -->
<mapping resource="com/test/contact.hbm.xml"/>

</session-factory>

</hibernate-configuration>

 
Ninad Kulkarni
Ranch Hand
Posts: 802
Java Linux
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 197
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hibernate.cfg.xml should be placed in the source directory of your project.
If you are using package structure, it should be out of packages, not beside your class file.
If you want to place beside your class file, you have to mention the path.

SessionFactory sessionFactory = new Configuration().configure("path").buildSessionFactory();
 
ksrk mahidhar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prabhakar Bokka wrote:hibernate.cfg.xml should be placed in the source directory of your project.
If you are using package structure, it should be out of packages, not beside your class file.
If you want to place beside your class file, you have to mention the path.

SessionFactory sessionFactory = new Configuration().configure("path").buildSessionFactory();



hi thanks for your reply

but i have placed that inside src directory still its showing the same error

my directory structure is

src
inside src i have config file and packges inside those package i have java files and contact.hbm.xml file
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 197
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ideally it should work. But why dont you try with the absolute path and relative path of the hibernate.cfg.xml?

SessionFactory sessionFactory = new Configuration().configure("path").buildSessionFactory();


If still not working post your code.
 
sarmaP lolla
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey We defined the class as

<mapping class="gov.aaa.domain.Assignment" />

Also our file is copied to the WEB-INF folder when we are deploying it to server.

Sarma
 
Narender Reddy Soma
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sarmaP lolla wrote:Hey We defined the class as

<mapping class="gov.aaa.domain.Assignment" />

Also our file is copied to the WEB-INF folder when we are deploying it to server.

Sarma


Paste the complete error stacktrace you are getting at console
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what people mean when they say source directory of your project is the route of your application's classpath (assuming you are using the default configuration opetion). Is it there?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic