2

Official Hibernate documentation contains a lot of deprecated features, like here

http://docs.jboss.org/hibernate/orm/4.1/quickstart/en-US/html_single/#d5e57

protected void setUp() throws Exception {
    // A SessionFactory is set up once for an application
    sessionFactory = new Configuration()
            .configure() // configures settings from hibernate.cfg.xml
            .buildSessionFactory();
}

while buildSessionFactory() is deprecated.

Where to get fresh Hibernate 4 documentation and quick examples?

UPDATE

Another example:

enter image description here

Here wee see as the author was suddenly killed while writing "... shows a Person class with a..." Babah!

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
  • This topic was already covered on Stackoverflow: http://stackoverflow.com/questions/8621906/is-buildsessionfactory-deprecated-in-hibernate-4 – Andreas Aumayr Oct 30 '13 at 20:10

1 Answers1

0

You should build your session factory in this way:

Configuration configuration = new Configuration().configure();
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().
applySettings(configuration.getProperties());
SessionFactory factory = configuration.buildSessionFactory(builder.build());

You can find more detail here: http://www.javabeat.net/session-factory-hibernate-4/

Accollativo
  • 1,537
  • 4
  • 32
  • 56