[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3864) "missing table" when hibernate.hbm2ddl.auto=validate and the database has tables named with SQL keywords

Oswaldo Dantas (JIRA) noreply at atlassian.com
Fri Apr 17 09:28:17 EDT 2009


"missing table" when hibernate.hbm2ddl.auto=validate and the database has tables named with SQL keywords
--------------------------------------------------------------------------------------------------------

                 Key: HHH-3864
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3864
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.1
         Environment: JBoss AS 5.0.1, JBoss Seam 2.1.1.GA, Hibernate 3.3.1, SQL Server 2000, jTDS 1.2.2 for JDBC, Eclipse 3.4.2, JBoss Tools 3.0.0.GA
            Reporter: Oswaldo Dantas
            Priority: Minor


Created a Seam Web Project in Eclipse and used the "Seam Generate Entities" wizard selecting some tables.
For instance, a table named User gets mapped with the annotation:
@Table(name = "USER", ...
Using this, the JDBC throws a invalid syntax near keyword USER
For this to work, the name must be escaped with braces:
@Table(name = "[USER]", ...
This work in the Eclipse Hibernate perspective, the Session Factory gets instanciated and HQL queries can be done, but when deploying to JBoss it throws a "missing table: [USER]" and aborts the deployment.
Then, after changing hibernate.hbm2ddl.auto=validate to NONE in persistence.xml, the project can be deployed and opened in the browser, "everything works".

So maybe there are two points here:
The generated mapping could escape names that could conflict with SQL keywords in different known dialects.
The validation on the deployment should understand the escaped names so it can be enabled without the "missing table" error.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list