在eclipse中应用hibernate来连接数据库时出现这样的问题!!!求高手
这是出现问题是显示的错误信息:Exception in thread "main" java.lang.Error: Unresolved compilation problems:
SessionFactory cannot be resolved to a type
Configuration cannot be resolved to a type
Session cannot be resolved to a type
Transaction cannot be resolved to a type
HibernateException cannot be resolved to a type
以下
这是测试用的java文件:
package ch03.hibernate;
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();
User user=new User();
user.setUsername("Hibernate");
user.setPassword("123");
session.save(user);
tx.commit();
session.close();
}catch(HibernateException e)
{
e.printStackTrace();
}
}
}
这是什么问题造成的呢???
搜索更多相关主题的帖子:
hibernate java 连接数据库 problems package
----------------解决方案--------------------------------------------------------