• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to compile the first hibernate program

 
Abhimanyu Jain
Ranch Hand
Posts: 151
1
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Following is the error that I am getting while compiling the above program:-

C:\Java Programs\First>javac -classpath "C:\HibernateLib\*" User.java
User.java:29: error: cannot access Configuration
config.addAnnotatedClass(User.class);
^
class file for org.hibernate.cfg.Configuration not found
User.java:30: error: cannot find symbol
config.configure("hibernate.cfg.xml");
^
symbol: method configure(String)
location: variable config of type AnnotationConfiguration
User.java:31: error: cannot find symbol
new SchemaExport(config).create(true,ture);
^
symbol: variable ture
location: class User
User.java:31: error: cannot find symbol
new SchemaExport(config).create(true,ture);
^
symbol: class SchemaExport
location: class User
4 errors

I am not able to resolve "import org.hibernate.tool.hbm2ddl.SchemaExport;" as well. Following is the "hibernate.cfg.xml" file

 
Abhimanyu Jain
Ranch Hand
Posts: 151
1
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am able to compile the program now. It compiled after adding "hibernate3.jar".

Thank you!!

But now my program is not able to locate "hibernate.cfg.xml" file when I run the program. Please help
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhimanyu Jain wrote:But now my program is not able to locate "hibernate.cfg.xml" file when I run the program. Please help


Where did you put the hibernate.cfg.xml file? What location does the server expect?
 
Abhimanyu Jain
Ranch Hand
Posts: 151
1
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My program worked fine after placing the hibernate.cfg.xml file in the same folder where I put java file.

Thank you!!
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!