質問

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

役に立ちましたか?

解決

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;

}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top