I\'m just trying to learn Hibernate (version 4 final) but I have a problem when trying to create the session factory. Here is some code related to the problem:
hi
The methods buildSessionFactory and ServiceRegistryBuilder in Hibernate 4.3.4 are deprecated.
The right code is here.
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
.....
Configuration conf = new Configuration()
.configure();
ServiceRegistry sr = new StandardServiceRegistryBuilder().applySettings(conf.getProperties()).build();
SessionFactory sf = conf.buildSessionFactory(sr);
Session session = sf.openSession();
session.beginTransaction();
YourDominClass ydc = new YourDominClass();
ydc.setSomething("abcdefg");
session.save(ydc);
session.getTransaction().commit();
session.close();
sf.close();
........