Dear Hibernaters,
I'm trying to work through the Tutorial example in Chapter1 and have become stuck. I'm trying to compile HibernateUtil.java but I'm getting compiler errors that the classes referenced in the Import statements cant be found.
The source code is as follows,
Code:
package util;
import org.hibernate.*;
import org.hibernate.cfg.*;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Create the SessionFactory from hibernate.cfg.xml
sessionFactory = new Configuration().configure().buildSessionFactory();
}catch (Throwable ex){
// Make sure you log the exception, as it might be swalledd
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory(){
return sessionFactory;
}
}
The Javac statement and error message is shown below.
D:\Data\java\eclipse\com.eclipse.hibernate\src>javac -cp ../lib/hsqldb.jar util/
HibernateUtil.java
util\HibernateUtil.java:3: package org.hibernate does not exist
import org.hibernate.*;
^
util\HibernateUtil.java:4: package org.hibernate.cfg does not exist
import org.hibernate.cfg.*;
^
util\HibernateUtil.java:8: cannot find symbol
symbol : class SessionFactory
location: class util.HibernateUtil
private static final SessionFactory sessionFactory;
^
util\HibernateUtil.java:21: cannot find symbol
symbol : class SessionFactory
location: class util.HibernateUtil
public static SessionFactory getSessionFactory(){
^
util\HibernateUtil.java:13: cannot find symbol
symbol : class Configuration
location: class util.HibernateUtil
sessionFactory = new Configuration().configure().buildSe
ssionFactory();
^
5 errors
I cant find the "org.hibernate.*" location. I've looked in the "hsqldb.jar" file but cant see anything there.
Does anyone have any pointers or suggestions please.
Regards
Robert.