Skip to content

Generated JPA entity uses SQL reserved words as column names (CURRENT-DATE -> current_date): the table is not created on H2 #4037

Closed

Description

@squid-protocol

Found while running the porting loop on CardDemo (#4023 follow-up). Every generated CardDemo project logs a failed DDL statement when Hibernate creates its schema on H2:

CommandAcceptanceException: Error executing DDL "create table pending_auth_details ( current_date integer, current_yyddd integer, ... )"
Caused by: JdbcSQLSyntaxErrorException: Syntax error in SQL statement "... [*]current_date integer ..."; expected "identifier"

The entity for PENDING-AUTH-DETAILS (app-authorization-ims-db2-mq) has a field from the COBOL item CURRENT-DATE. It is mapped to the column current_date, which is a reserved word in H2 (and in standard SQL). The table is not created. Any repository call on that entity then fails. Programs that don't touch it (every equivalence case so far) run, but a port of the authorization programs would hit it.

Fix

When a generated column name is an SQL reserved word, quote it or rename it, e.g. @Column(name = "\"CURRENT_DATE\""), or a suffix like current_date_. The alternative is hibernate.globally_quoted_identifiers in the generated config. Either way the check should cover the reserved words of every target database the generator supports (H2, PostgreSQL, DB2), not just this one name. Add a test with a COBOL item named CURRENT-DATE / USER / ORDER.

🤖 Generated with Claude Code

Activity

  1. added
    bug
    legacy-modernization
    on Sep 30, 2026
  2. added
    scope:core
    era:4
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugera:4legacy-modernizationscope:core

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions