hibernate session.get报错
packagetest;importhibernate.HibernateSessionFactory;importmodel.Booktable;importorg.h...
package test;
import hibernate.HibernateSessionFactory;
import model.Booktable;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class Test {
public static void main(String[] args){
Session s=HibernateSessionFactory.getSession();
Booktable bt=new Booktable();
bt=(Booktable)s.get(bt.getBookid(),1);
System.out.println(bt.getBookcb());
HibernateSessionFactory.closeSession();
}
}
}
The method get(Class, Serializable) in the type Session is not applicable for the
arguments (Integer, int)
请问怎么解决 展开
import hibernate.HibernateSessionFactory;
import model.Booktable;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class Test {
public static void main(String[] args){
Session s=HibernateSessionFactory.getSession();
Booktable bt=new Booktable();
bt=(Booktable)s.get(bt.getBookid(),1);
System.out.println(bt.getBookcb());
HibernateSessionFactory.closeSession();
}
}
}
The method get(Class, Serializable) in the type Session is not applicable for the
arguments (Integer, int)
请问怎么解决 展开
2个回答
展开全部
修改一下:
public static void main(String[] args){
Session s=HibernateSessionFactory.getSession();
Booktable bt=(Booktable)s.get(Booktable.class,1);
System.out.println(bt.getBookcb());
HibernateSessionFactory.closeSession();
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询