Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-3075

HV-271 - HV does not take care "`" to avoid reserved keywords in the sql statements

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: EAP 5.0.0, 4.2.0.GA_CP08, 4.3.0.GA_CP07
    • Fix Version/s: TBD
    • Component/s: Hibernate
    • Labels:
      None
    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Override the name of the column to an non-quoted name:
      @Column(name="xsize")

      Show
      Override the name of the column to an non-quoted name: @Column(name="xsize")
    • Release Notes Text:
      Hide
      If a database reserved keyword is used as a property name with a Hibernate Validator annotation (for example, <literal>@Min</literal> or <literal>@Max</literal>), it will cause exceptions in <classname>SchemaExport</classname>, even if you specify a column name. This is because Hibernate ignores the name specified. The workaround is to map the property name to something that is not a database reserved keyword with the <literal>@Column</literal> annotation. The fix for this issue is expected in Hibernate 4.
      Show
      If a database reserved keyword is used as a property name with a Hibernate Validator annotation (for example, <literal>@Min</literal> or <literal>@Max</literal>), it will cause exceptions in <classname>SchemaExport</classname>, even if you specify a column name. This is because Hibernate ignores the name specified. The workaround is to map the property name to something that is not a database reserved keyword with the <literal>@Column</literal> annotation. The fix for this issue is expected in Hibernate 4.
    • Release Notes Docs Status:
      Not Required

      Description

      this can be reproduced by JPAValidateListenerTest on oracle
      Model org.hibernate.validator.test.jpa.Submarine contains a property named "size", which gets translated to column "size", but this word is reserved in Oracle, causing exceptions in SchemaExport (create table) and consequently the test fails.

      After quoting[1] the name of the column, the DDL for the table becomes incorrect, causing a failure in Oracle. When using a different[2] name, the test passes.

      Failure when using [1]:
      17:45:44,631 ERROR SchemaExport:274 - Unsuccessful: create table Submarine (id number(19,0) not null, commander_name varchar2(255 char), name varchar2(255 char) not null, "size" number(19,0) check (size>=10), primary key (id))
      17:45:44,632 ERROR SchemaExport:275 - ORA-00936: missing expression

      [1] @Column(name="`size`")
      [2] @Column(name="xsize")

      http://opensource.atlassian.com/projects/hibernate/browse/HV-271

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                epbernard Emmanuel Bernard
                Reporter:
                juraci.costa Juraci Paixão Kröhling
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: