好像是SQL语法有错??
You have an error in your SQL syntax;
查你数据库错误码:1064是什么意思,再加以解决!

解决方案 »

  1.   

    老大我都检查了HQL没有错误.
    我在检查tomcat启动过程中发现下面错误;
    2006-09-25 11:30:41,781 INFO [net.sf.hibernate.impl.SessionFactoryImpl] - <build
    ing session factory>
    2006-09-25 11:30:49,484 INFO [net.sf.hibernate.impl.SessionFactoryObjectFactory]
     - <Not binding factory to JNDI, no JNDI name configured>
    @hibernate: The hibernate SessionFactory has been started... ...2006-09-25 14:18:44,468 INFO [net.sf.hibernate.connection.DatasourceConnectionPr
    ovider] - <Using datasource: java:comp/env/jdbc/rjzysy>
    2006-09-25 14:18:44,484 INFO [net.sf.hibernate.transaction.TransactionFactoryFac
    tory] - <Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFacto
    ry>
    2006-09-25 14:18:44,515 INFO [net.sf.hibernate.transaction.TransactionManagerLoo
    kupFactory] - <No TransactionManagerLookup configured (in JTA environment, use o
    f process level read-write cache is not recommended)>
      

  2.   

    这些启动信息不是错误。
    你打开hibernate的debuglog,把出错前的SQL文刷出来看看。
      

  3.   

    设置你的hibernate的配置文件的这个结点:
    <property name="hibernate.show_sql">true</property>
    把SQL语句打出来,这样的情况是由于HQL有误然后经hibernate转换为错误的sql语句所致!
    所以打出SQL语句后好确定问题所在!
      

  4.   

    hql 有问题,去查查吧。或者你把dialect 搞错了?
      

  5.   

    语法错误,这个是mysql爆出的错误
      

  6.   

    qingoodrar(神吹) 
    我在hibernate-config.xml中加了此属性但是由于同事以前写程序写到jar包中没有办法改;点对应连接执行在tomcat中出现下面错误
    Hibernate: select tbcontenta0_.Id as Id, tbcontenta0_.NodeId as NodeId, tbconten
    ta0_.Title as Title, tbcontenta0_.TitleStyle as TitleStyle, tbcontenta0_.Brief a
    s Brief, tbcontenta0_.BriefStyle as BriefStyle, tbcontenta0_.pic1 as pic1, tbcon
    tenta0_.pic2 as pic2, tbcontenta0_.pic3 as pic3, tbcontenta0_.pic4 as pic4, tbco
    ntenta0_.var1 as var1, tbcontenta0_.var2 as var2, tbcontenta0_.var3 as var3, tbc
    ontenta0_.var4 as var4, tbcontenta0_.Note as Note, tbcontenta0_.NoteStyle as Not
    eStyle, tbcontenta0_.Source as Source, tbcontenta0_.SourceStyle as SourceS18_, t
    bcontenta0_.KeyWords as KeyWords, tbcontenta0_.UpdateTime as UpdateTime, tbconte
    nta0_.PublishTime as Publish21_, tbcontenta0_.PublishTimeStyle as Publish22_, tb
    contenta0_.Author as Author, tbcontenta0_.AuthorStyle as AuthorS24_, tbcontenta0
    _.Content as Content, tbcontenta0_.ContentEdited as Content26_, tbcontenta0_.Edi
    tor as Editor, tbcontenta0_.Publisher as Publisher, tbcontenta0_.IsDisplay as Is
    Display, tbcontenta0_.State as State, tbcontenta0_.FileName as FileName, tbconte
    nta0_.Sort as Sort, tbcontenta0_.Count as Count from tb_content_articles tbconte
    nta0_ where (tbcontenta0_.NodeId=1 )and(tbcontenta0_.State=0 ) order by  tbconte
    nta0_.Sort desc limit ?
    2006-09-26 09:48:04,671 WARN [net.sf.hibernate.util.JDBCExceptionReporter] - <SQ
    L Error: 1064, SQLState: 42000>
    2006-09-26 09:48:04,671 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <Y
    ou have an error in your SQL syntax; check the manual that corresponds to your M
    ySQL server version for the right syntax to use near '?' at line 1>
    2006-09-26 09:48:04,671 WARN [net.sf.hibernate.util.JDBCExceptionReporter] - <SQ
    L Error: 1064, SQLState: 42000>
    2006-09-26 09:48:04,671 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] - <Y
    ou have an error in your SQL syntax; check the manual that corresponds to your M
    ySQL server version for the right syntax to use near '?' at line 1>
    Hibernate: select tbcontentn0_.Id as Id, tbcontentn0_.ParentId as ParentId, tbco
    ntentn0_.Label as Label, tbcontentn0_.Type as Type, tbcontentn0_.Img as Img, tbc
    ontentn0_.Sort as Sort, tbcontentn0_.About as About, tbcontentn0_.RegistTime as
    RegistTime, tbcontentn0_.IsDisplay as IsDisplay from tb_content_node tbcontentn0
    _ where (tbcontentn0_.Id=1 )and(tbcontentn0_.ParentId<>0 ) order by  tbcontentn0
    _.Id
      

  7.   

    你分页的时候设置的参数不对,请检查你的分页模块的实现吧,limit 这里的参数
      

  8.   

    楼上说的有道理。最后LIMIT 的参数
      

  9.   

    问题解决以前的程序用的
    mysql驱动是mysql connector 3.1.7我用3.1.6就不行。