• 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: 3585
16
Android Java
  • 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!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic