【问题标题】:JSF, HibernateJSF,休眠
【发布时间】:2009-06-23 06:17:30
【问题描述】:

我有一个名为 Items 的表。当我尝试在 MyEclipse 中执行“休眠逆向工程”并运行程序时,出现此错误:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:
You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near '?tems0_.ItemID as ItemID8_, ?tems0_.ItemGroupID as ItemGrou2_8_, ?tems0_.ItemEnt' at line 1

我在 hibernate.cfg.xml 上写了show_sql = true。现在我得到了sql,但我不知道问题出在哪里?有人可以帮我吗?

这是来自控制台的我的 sql:

休眠:

select ıtems0_.ItemID as ItemID8_, ıtems0_.ItemGroupID as ItemGrou2_8_,
  ıtems0_.ItemEnterDate as ItemEnte3_8_, ıtems0_.ItemAuthor as ItemAuthor8_,
  ıtems0_.ItemTitle as ItemTitle8_, ıtems0_.ItemDetail as ItemDetail8_,
  ıtems0_.ItemPic as ItemPic8_, ıtems0_.ItemMainNews as ItemMain8_8_,
  ıtems0_.ItemGroup5 as ItemGroup9_8_, ıtems0_.ItemGroup10 as ItemGroup10_8_,
  ıtems0_.ItemFrontpage as ItemFro11_8_, ıtems0_.ItemVisited as ItemVis12_8_,
  ıtems0_.ItemProposed as ItemPro13_8_, ıtems0_.ItemVoted as ItemVoted8_, 
  ıtems0_.ItemScored as ItemScored8_, ıtems0_.ItemDisabled as ItemDis16_8_,
  ıtems0_.ItemNewsGroup as ItemNew17_8_ from news.items ıtems0_.

我认为字符“ı”有问题。

谢谢。

【问题讨论】:

    标签: mysql hibernate hql


    【解决方案1】:
     ...from news.items ıtems0_.
    

    这个问题在最后是句号。这真的是hibernate产生的sql吗?

    【讨论】:

      【解决方案2】:

      是的,就是hibernate产生的sql。

      我想我找到了这个问题的答案。我的电脑的语言设置与英语不同。我将语言设置更改为英语,然后使用 Hibernate 逆向工程从我的表中创建了我的类。一切都变好了。

      【讨论】:

        猜你喜欢
        • 2012-12-05
        • 2012-07-04
        • 2011-03-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-06
        • 1970-01-01
        • 2011-12-16
        相关资源
        最近更新 更多