新建一个工程,用Myeclipse生成以后HQL EDITOR可用.但是在旧工程里生成一个包,然后把表反序列化生成类到包里以后,用这个工程Myeclipse->HQL Editor...
右下角出现Session factory not created for configuration: MyHibernate提示硬写from tableA就出现
A session factory for this configuration could not be built,dynamic query translation will be unavailable . Queries cannot be executed.Reason:
Association references unmapped class: dboperation.Exceptionrecord若是说配置问题,但是我写了测试类:
ExceptionrecordDAO hdao=new ExceptionrecordDAO();
List xxx=hdao.getSession().createQuery("from Exceptiontyperef").list();
for (int i=0;i<xxx.size();i++)
{
Exceptiontyperef er=(Exceptiontyperef)xxx.get(i);
System.out.println(er.getTypeid());
}却能够正确的读取出数据库里的值,也就是说配置应该没问题百思不得其解,求助

解决方案 »

  1.   

    from  tableA
    中的 tableA   t 是小写的,不知道你的类名是不是也是小写的。
    from 后面跟的上对象应该同你的类名保持一致而不是表名。
      

  2.   

    但是在旧工程里生成一个包,然后把表反序列化生成类到包里以后,用这个工程Myeclipse->HQL Editor...
    右下角出现Session factory not created for configuration: MyHibernate提示硬写from tableA就出现
    A session factory for this configuration could not be built,dynamic query translation will be unavailable . Queries cannot be executed. 

    发现你在hql里面写的是sql语句,按照常理来说,你在hql编辑里面就应该写hql语句吧。
      

  3.   

    我和楼主一样的问题:在Hibernate Dynamic Query Translator 中出现:Session factory not created for configuration: hibernatedemo
    public static void main(String[] args)
    {
    Session session = HibernateSessionFactory.getSession();
    Query q = session.createQuery("from BgBlog");
    List list = q.list();
    for(Object o:list)
    {
    BgBlog b = (BgBlog)o;
    System.out.println(b.getItemid());
    }
    session.close();
    }
    取值正确。
    唯一的问题就是:在HQL Editor中输入任何内容运行,没有任何反应。没有结果,也没有看到大家说的报错信息。百思不解!
      

  4.   


    如果代码没问题的话说明 持久化关系没错 我一开始也是HQL EDITOR没反应,刷新一下就好了 就是HQL editor界面的 绿色箭头右边的