简体   繁体   中英

Jsf Netbeans, Hibernate, Get Session Factory cannot find symbol error

Im doing a JSF Project using Netbeans for school. I got a simple Problem. My Code is: `

public class PlayerData{

   private Player pl;
   private HibernateUtil helper;
   private Session session;

    public void addMember(){
       pl=new Player ("Example")
       session=helper.getSessionFactory().getCurrentSession();
       session.beginTransaction();
       session.save(pl);
       session.getTransaction().commit();
       session.close()

}

}

`

My Error = cannot find symbol symbol:method getSessionFactory() location: variable helper of type HibernateUtil

I know project for school is probably now finished but many others are reading this question and need the answer. Solution is: You need to make your own HibernateUtil class. How? Answer is here and here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM