Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7062769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:38:02+00:00 2026-05-28T04:38:02+00:00

When I updated the Hibernate version from 3.6.8 to 4.0.0, I got a warning

  • 0

When I updated the Hibernate version from 3.6.8 to 4.0.0, I got a warning about deprecated method buildSessionFactory() in this line:

private static final SessionFactory sessionFactory =
         new Configuration().configure().buildSessionFactory();

the Javadoc recommends using another method

buildSessionFactory(ServiceRegistry serviceRegistry)

but in the documentation I found deprecated variant

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:38:02+00:00Added an answer on May 28, 2026 at 4:38 am

    Yes it is deprecated. Replace your SessionFactory with the following:

    In Hibernate 4.0, 4.1, 4.2

    private static SessionFactory sessionFactory;
    private static ServiceRegistry serviceRegistry;
    
    public static SessionFactory createSessionFactory() {
        Configuration configuration = new Configuration();
        configuration.configure();
        ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(
                configuration.getProperties()). buildServiceRegistry();
        sessionFactory = configuration.buildSessionFactory(serviceRegistry);
        return sessionFactory;
    }
    

    UPDATE:

    In Hibernate 4.3 ServiceRegistryBuilder is deprecated. Use the following instead.

    serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
                configuration.getProperties()).build();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just updated to Hibernate 3.6.5.Final from 3.3.0.GA and have run into a
I've recently updated from hibernate 3.3.1.GA to hibernate 3.5.0 and I'm having a lot
Just updated from Hibernate 3.6 to Hibernate 4, now getting 10-Feb-2012 14:12:31 org.hibernate.dialect.DerbyDialect <init>
I have got couple questions about changing hibernate configuration. There is a project say
I recently got the latest version of Hibernate and noticed that my UserTypes now
I recently upgrade Hibernate from version 3.3.x to 3.6.4. In version 3.3.x validateSchema (hibernate.hbm2ddl.auto=validate)
I am following this titorial on roseindia to get basics of Hibernate : http://roseindia.net/hibernate/hibernate-update.shtml
I am going through lock method of hibernate. I did not get what we
I am using Hibernate 3.6.0 with JPA 2 on Jboss AS 6.0.0 final. In
I use NHibernate 3.1 and I updated to version 3.2. Also I use confOrm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.