session.createQuery(“from table_name”)中的from报红线,显示from unexpected,能正常运行,测试结果也能正常打印,但控制台打印了如下警告:WARN: HHH000233: Scoping types to session factory org.hibernate.internal.SessionFactoryImpl@16f7b4af after already scoped org.hibernate.internal.SessionFactoryImpl@16f7b4af;希望厉害的朋友帮我分析一下,有可能是哪里出了问题?

解决方案 »

  1.   

    参考
    https://stackoverflow.com/questions/9178379/hibernate-incomprehensible-warning
      

  2.   

    from前面加个空格
      

  3.   

     换个方式 试试:select s.* from table_name s 
      

  4.   

    如果写表名的话   就要用  createSQLQuery   否则用标准的hql   要写实体类名
      

  5.   

    实体类啊,hql和sql分不清?
      

  6.   

    把你的table_name换成对应的实体类名字试试