-->
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.  [ 4 posts ] 
Author Message
 Post subject: The method buildSessionFactory() is deprecated
PostPosted: Mon Jan 04, 2016 5:33 pm 
Newbie

Joined: Sun Jan 03, 2016 3:35 pm
Posts: 4
What i write not correctly?

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
private static SessionFactory sessionFactory = null;

static {
try {
//creates the session factory from hibernate.cfg.xml
sessionFactory = new Configuration().configure().buildSessionFactory(); //!!!The method buildSessionFactory() from the type Configuration is deprecated

} catch (Exception e) {
e.printStackTrace();
}
}

public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}


Top
 Profile  
 
 Post subject: Re: The method buildSessionFactory() is deprecated
PostPosted: Tue Jan 05, 2016 3:31 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
This is the new way for creating a SessionFactory:

Code:
Configuration configuration = new Configuration().addProperties(properties);
SessionFactory sf = configuration.buildSessionFactory(
    new StandardServiceRegistryBuilder()
        .applySettings(properties)
        .build()
);


Top
 Profile  
 
 Post subject: Re: The method buildSessionFactory() is deprecated
PostPosted: Tue Jan 05, 2016 2:53 pm 
Newbie

Joined: Sun Jan 03, 2016 3:35 pm
Posts: 4
How we can set properies?
Senks.


Top
 Profile  
 
 Post subject: Re: The method buildSessionFactory() is deprecated
PostPosted: Wed Jan 06, 2016 12:32 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
There's a bootsraping chapter in the new User Guide:

http://docs.jboss.org/hibernate/orm/5.0/userGuide/en-US/html_single/#bootstrap


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.