"is the buildsessionfactory() configuration method deprecated in hibernate" Code Answer

1

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();
By obeliksz on July 15 2022

Answers related to “is the buildsessionfactory() configuration method deprecated in hibernate”

Only authorized users can answer the Search term. Please sign in first, or register a free account.