Question

I can't use buildServiceRegistry because it's not defined, the import:

import org.hibernate.service.ServiceRegistryBuilder;

Is strikethrough

public SessionFactory open (){

        Configuration configuration=new Configuration();
        configuration.configure();
        ServiceRegistry sr= new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
        SessionFactory sf=configuration.buildSessionFactory(sr);

        return sf;

}

What I need is the Session object, any alternatives?¿ And why can I use the same code on a Java Project but not on a Dynamic Web Proyect¿? Thank you very much

Était-ce utile?

La solution

Okey seems I have answered myself, I don't know why it works, but works, despite the buildSessionFactory is strikthrough

public SessionFactory open (){

    Configuration configuration=new Configuration();
    configuration.configure();
    SessionFactory sf = new Configuration().configure().buildSessionFactory();

    return sf;

}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top