标题:在eclipse中应用hibernate来连接数据库时出现这样的问题!!!求高手
只看楼主
尘埃落雪
Rank: 2
等 级:论坛游民
帖 子:34
专家分:17
注 册:2010-6-7
结帖率:88.89%
 问题点数:0 回复次数:0 
在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);
            
            ();
            
            session.close();
               
        }catch(HibernateException e)
        {
                e.printStackTrace();
            
        }
    }
}
这是什么问题造成的呢???
搜索更多相关主题的帖子: hibernate java 连接数据库 problems package 
2011-09-05 22:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-349240-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022326 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved