java.lang.NoClassDefFoundError: org/hibernate/Session

iworkwork 2005-12-13 03:24:13
import org.hibernate.*;
import org.hibernate.cfg.*;

public class Test {

public static void main(String[] args) {
try{
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session session = sf.openSession();
Transaction tx = session.beginTransaction();

for (int i = 0; i <200; i++) {
Customer customer = new Customer();
customer.setUsername("customer" + i);
customer.setPassword("customer");
session.save(customer);
}

tx.commit();
session.close();
}catch(Exception e){}
}}
我用的是3.0,请问各位,这是什么错误??
...全文
143 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
iworkwork 2005-12-13
  • 打赏
  • 举报
回复
public class Customer {
private int id;
private String username;
private String password;

/**
* @return Returns the id.
*/
public int getId() {
return id;
}
/**
* @param id The id to set.
*/
public void setId(int id) {
this.id = id;
}
/**
* @return Returns the password.
*/
public String getPassword() {
return password;
}
/**
* @param password The password to set.
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return Returns the username.
*/
public String getUsername() {
return username;
}
/**
* @param username The username to set.
*/
public void setUsername(String username) {
this.username = username;
}

}

可以的话我们qq
50794638
kangbo198284 2005-12-13
  • 打赏
  • 举报
回复
Customer customer = new Customer();
Customer 它从哪儿来?
请把这个对像贴出来,再帮你看看。

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧