Hibernate version: 3.05
Hello - First of all thanks for the book - it has been a very good introduction to Hibernate. I do have some questions however.
I've been trying to work through the "Hello World" example, and have hit a couple of snags. On ps. 32 and also on 33 there is the line:
Code:
Session session = getSessionFactory().openSession
However even with adding the appropriate libraries, imports etc. the getSessionFactory() method cannot be found (at least using the IDE I'm using - JBuilder 2005).
Digging into the CaveatEmptor example, instead I noticed that there were the lines:
Code:
SessionFactory factory
and later on:
Code:
Session s = factory.openSession();
Even when trying this though, I get a NullPointerException when the program hits the uninitialized factory.
So I guess I was wondering,
is there an updated version of the Hello World program that includes a more complete version of the runnable part? For instance, right now I have:
Code:
package hibernate;
import org.hibernate.*;
public class Hello {
SessionFactory factory;
public Hello() {
Session s = factory.openSession();
Transaction tx = s.beginTransaction();
Message message = new Message("Hello World");
s.save(message);
tx.commit();
s.close();
}
public static void main(String[] args) {
Hello h = new Hello();
}
}
Sorry that this is such a newbie question, but that's why I got the book! Thanks,