代码如下:
public static void main(string[]args)
{
SessionFactory sf=new configration().configure().buildSessionFactory();
Session session = sf.OpenSession();
Medal medal = new medal();
medal.setOwner("totong");
medal.setType("gold medal");
Session.save(user);
Session.close();
}
public static void main(string[]args)
{
SessionFactory sf=new configration().configure().buildSessionFactory();
Session session = sf.OpenSession();
Medal medal = new medal();
medal.setOwner("totong");
medal.setType("gold medal");
Session.save(user);
Session.close();
}
解决方案 »
- 采用SSH框架进行web开发的问题
- Spring security3.1集成Struts2的问题。困惑好几天了。
- hql语句
- struts1.2 spring hibernate 执行自定义方法问题 在线等
- 搞软件开发的应届毕业生一开始去那里工作比较好啊
- 我要到澳门工作了,谁知道澳门那里有屋租?
- 求一个struts+hibernate+spring的实际项目代码---200分
- hibernateSync连接oracle数据库的问题!
- 求在hibernate中显示记录的代码
- struts ActionErrors执行不了,帮我看看,是为什么?????
- dom4j解析一下XML,并将解析出来的值保存到类test1和test2中
- struts2中选中下拉框中的一项出现它所对应的checkbox选项,并连接了数据库
public static void main(string[]args)
{
SessionFactory sf=new configration().configure().buildSessionFactory();
Session session = sf.OpenSession();
Transaction transaction = session.beginTransaction();
Medal medal = new medal();
medal.setOwner("totong");
medal.setType("gold medal");
Session.save(user);
transaction.commit();
Session.close();
}
2.Session.save(user);user哪里来的啊?
session.flush();
session.close();