2 Replies Latest reply on Sep 23, 2006 1:34 PM by johnurban

    MySQL SQL Syntax Problem

    johnurban

      Using:

      jboss-4.0.4.GA
      jboss-seam-1.0.1.GA
      eclipse 3.2.0
      jboss reverse engineer tool in eclipse

      I geneated, compiled and successfully deployed my sean app to JBoss. I added a record successfully to one of the tables. When I went to search for a record, I get this:

      11:31:06,578 INFO [STDOUT] Hibernate: select top ? room0_.ID as ID10_, room0_.Name as Name10_, room0_.OrganizationID as Organiza3
      _10_, room0_.Capacity as Capacity10_ from checkin.room room0_
      11:31:06,625 WARN [JDBCExceptionReporter] SQL Error: 1064, SQLState: 42000
      11:31:06,625 ERROR [JDBCExceptionReporter] You have an error in your SQL syntax; check the manual that corresponds to your MySQL s
      erver version for the right syntax to use near '1 room0_.ID as ID10_, room0_.Name as Name10_, room0_.OrganizationID as Organiza3'
      at line 1
      11:31:06,625 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
      javax.servlet.ServletException: Error calling action method of component with id _id2:_id27
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

      This is bad SQL. Is this a bug. I haven't touched the generated code.

      Thanks.

        • 1. Re: MySQL SQL Syntax Problem
          johnurban

          ... a bit more research. MySQL [5.0] reference manual does not have a keyword TOP for a select sql paragraph:

          http://dev.mysql.com/doc/refman/5.0/en/select.html

          SELECT
          [ALL | DISTINCT | DISTINCTROW ]
          [HIGH_PRIORITY]
          [STRAIGHT_JOIN]
          [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
          [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
          select_expr, ...
          [FROM table_references
          [WHERE where_condition]
          [GROUP BY {col_name | expr | position}
          [ASC | DESC], ... [WITH ROLLUP]]
          [HAVING where_condition]
          [ORDER BY {col_name | expr | position}
          [ASC | DESC], ...]
          [LIMIT {[offset,] row_count | row_count OFFSET offset}]
          [PROCEDURE procedure_name(argument_list)]
          [INTO OUTFILE 'file_name' export_options
          | INTO DUMPFILE 'file_name'
          | INTO @var_name [, @var_name]]
          [FOR UPDATE | LOCK IN SHARE MODE]]

          How can we get rid of the "top" keyword in the SQL string?

          • 2. Re: MySQL SQL Syntax Problem
            johnurban

            I posted again in the wrong spot. This problem was quickly solved by the Seam folks. I was using the wrong dialect:

            Please see:

            http://www.jboss.com/index.html?module=bb&op=viewtopic&t=91285&watch=topic&start=0