SessionOperator so=new SessionOperator();这个代码贴一下.
解决方案 »
- 有谁用过iText的,请问怎么生成目录,100分答谢
- 关于权限管理的数据库设计
- 如何用Java实现导出excel
- Hibernate能否获取存储过程里的输出参数?
- (求)有谁用过ibm websphere studio.....编JSP吗
- 各位进来帮个忙,实在搞不出来了,简单的问题.struts
- [求助]请问Web Service是什么?和J2EE,EJB是啥关系??谢谢!!!
- 请问JAVA中如何实现同时控制几千个在线用户?有没有类型WINDOWS的完成端口技术
- 求教如何能实时的将socket服务端接受的数据存入数据库
- ActiveMQ阻塞问题
- 怎样通过cookie记录浏览者访问过的页面
- 关于org.springframework.beans.factory.BeanFactory的getBean(),报NullPointerException
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;public class SessionOperator
{
private Session session;
public SessionOperator()
{
Configuration config=new Configuration().configure();
this.session=config.buildSessionFactory().openSession();
}
public void insert(Student student)
{
Transaction tx=this.session.beginTransaction();
tx.begin();
this.session.save(student);
tx.commit();
}
public void insert(Teacher teacher)
{
Transaction tx=this.session.beginTransaction();
tx.begin();
this.session.save(teacher);
tx.commit();
}
}
可以加我QQ32446314