1 Reply Latest reply on Sep 16, 2010 3:13 AM by xsalefter.xsalefter.yahoo.com

    Bug with Seam generate entities in Eclipse

    cinephil
      Hello,
      I'm new to Seam and I'm posting from France.

      This afternoon, I tried a simple Seam project called test with Eclipse and JBoss Tools.

      After the project had been generated by the command New Seam Project, I created a simple table on MySQL Server :


      "CREATE TABLE `users` (
        `usr_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
        `username` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
        `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
        `password` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
        PRIMARY KEY (`usr_id`),
        UNIQUE KEY `username` (`username`)
      ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"

      Then I used the command New Seam Generate Entities and the operation seamed OK and has created :
      - Users.page.xml ;
      - Users.xhtml ;
      - UsersEdit.page.xml ;
      - UsersEdit.xhtml ;
      - UsersList.page.xml ;
      - UsersList.xhtml ;
      - Users.java (the entity)
      - UsersHome.java
      - UsersList.java

      I did not touch any code generated and I tried to "BrowseData" / UsersList. Then I had these errors :
      "javax.el.ELException: /UsersList.xhtml: Error reading 'resultList' on type org.domain.test.session.UsersList_$$_javassist_seam_2
      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
      Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
      Caused by: com.mysql.jdbc.exceptions.jdbc4.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 '.users users0_ limit 26' at line 1 "
      The last error is interesting !
      How can I see the real query sent to MySQL Server ?

      Isn't it a bug in the Generate Entities tool ?

      Before this test, I tried with a Seam example and with the real database (and more complex of course !) on witch I have to work.
      The same errors occured.

      I have initiated the same discussion in French on http://www.developpez.net/forums/d970848/java/developpement-web-java/frameworks/jsf/seam/mapping-bdd-incorrect-generate-entities/#post5449934