注册 登录
编程论坛 J2EE论坛

[求助]Hibernate的删除

JAVAboy 发布于 2007-04-16 08:33, 569 次点击
我在hibernate中写了一个从数据库中删除用户信息的小程序
让它在主函数中运行~
但是有错~
帮忙看看~~
public static void main(String argc[])
{
SessionFactory sf=new Configuration().configure().buildSessionFactory();
Session we=sf.openSession();
Transaction wr=we.beginTransaction();
T1 u=(T1)we.get(T1.class,new Integer(1));
we.delete(u);
wr.commit();
we.close();

}
我导的包:
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session;
2 回复
#2
支离破碎2007-04-16 11:19
报什么错?是否你的hiberate配置文件正确加载到了。
#3
JAVAboy2007-04-19 08:03

回复支离破碎
谢了~
问题解决了
原因是表用错了~~

1