How to map an entity field whose name is a reserved word in JPA

前端 未结 7 1665
陌清茗
陌清茗 2020-11-22 12:35
@Column(name=\"open\")

Using sqlserver dialect with hibernate.

[SchemaUpdate] Unsuccessful: create table auth_session (id numeric(1         


        
7条回答
  •  梦谈多话
    2020-11-22 12:56

    No - change the column name.

    This is database-specific, and you just can't create such a column. After all hibernate finally sends DDL to the database. If you can't create a valid DDL with this column name, this means hibernate can't as well. I don't think quoting would solve the issue even if you are writing the DDL.

    Even if you somehow succeed to escape the name - change it. It will work with this database, but won't work with another.

提交回复
热议问题