-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: package org.hibernate doesnot exist
PostPosted: Wed Sep 30, 2009 8:36 am 
Newbie

Joined: Wed Sep 30, 2009 8:28 am
Posts: 10
import org.hibernate.*;
^
nataraja\nataraja.java:7: cannot find symbol
symbol : class Session
location: class nataraja.nataraja
Session session = null;
^
nataraja\nataraja.java:10: cannot find symbol
symbol : class SessionFactory
location: class nataraja.nataraja
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
^
nataraja\nataraja.java:10: cannot find symbol
symbol : class Configuration
location: class nataraja.nataraja
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();


How to include those required packages?
What jar files do i need to have?
How to execute a simple program?


Thanks in advance


Top
 Profile  
 
 Post subject: Re: package org.hibernate doesnot exist
PostPosted: Wed Sep 30, 2009 9:37 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
Depends on the version of Hibernate you are using. If you have 3.3.1 or above there is a folder lib/required. And you need hibernate3.jar or course.


Top
 Profile  
 
 Post subject: Re: package org.hibernate doesnot exist
PostPosted: Wed Sep 30, 2009 11:48 pm 
Newbie

Joined: Wed Sep 30, 2009 8:28 am
Posts: 10
Thanks CDillinger for your reply.

I am new to hibernate. So i am in great confusion.
I have jdk 1.5.10 installed in my machine.
I dont have eclipse as for now.

Also i have the following jar files hibernate-core,hibernate-commons-annotations,hibernate-annotations,hibernate-entitymanager,
hibernate-jmx,hibernate-validator,hsqldb.

I created a class file with name First_Hiberanate_Exercise and Employee.
This Employee class is mapped to Employee table in MySql database.
And I have 2 XML files
* Hibernate.cfg.xml for setting connection with the database and mapping to particular table.
* Employee.hbm.xml for mapping to table fields.

When i tried to compile the two .java files (First_Hiberanate_Exercise.java and Employee.java)
using javac classpath .;hibernate-core.jar First_Hiberanate_Exercise.java
It compiled succesfully.

But i am not able to execute it.
Also mention the correct syntax for executing it.


If you dont mind can you please paste here a sample program including the xml files...


Top
 Profile  
 
 Post subject: Re: package org.hibernate doesnot exist
PostPosted: Wed Sep 30, 2009 11:56 pm 
Newbie

Joined: Wed Sep 30, 2009 8:28 am
Posts: 10
C:\javap>java -classpath .;hibernate-core.jar First_Hibernate_Exercise
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Exception in thread "main" java.lang.NullPointerException
at First_Hibernate_Exercise.main(First_Hibernate_Exercise.java:27)

I am getting this error while executing.


Top
 Profile  
 
 Post subject: Re: package org.hibernate doesnot exist
PostPosted: Thu Oct 01, 2009 1:20 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
Downloading everything that sounds like hibernate doesn't solve your problem... If you go to www.hibernate.org and download "Hibernate Core" you get a zip-File which contains the folder I mentioned above. All those jar-Files are required. (Plus a logger-Implementation for slf4j).


Top
 Profile  
 
 Post subject: Re: package org.hibernate doesnot exist
PostPosted: Wed Oct 07, 2009 10:19 am 
Newbie

Joined: Wed Sep 30, 2009 8:28 am
Posts: 10
thanks CDillinger...

I cleared all the hurdles...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.