问题描述
@Column(name =open)
使用带有hibernate的sqlserver方言。
$ b $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $' activeint tinyint null,creation_date datetime not null,last_modified datetime not null,maxidle int null,maxlive int null,open tinyint null,sessionid varchar(255)not null,user_id numeric(19,0)not null,主键(id), unique(sessionid))
[SchemaUpdate]关键字'open'附近的语法不正确。
我希望hibernate在创建表时使用带引号的标识符。
关于如何处理这个问题的任何想法...除了重命名字段之外?
同样的问题,但是有一个名为 Transaction
的表名。如果你设定了
pre $ hibernate.globally_quoted_identifiers = true
然后将引用所有数据库标识符。
在这里找到我的答案
在这里找到所有可用的设置
找不到更好的文档这虽然。
@Column(name="open")
Using sqlserver dialect with hibernate.
[SchemaUpdate] Unsuccessful: create table auth_session (id numeric(19,0) identity not null, active tinyint null, creation_date datetime not null, last_modified datetime not null, maxidle int null, maxlive int null, open tinyint null, sessionid varchar(255) not null, user_id numeric(19,0) not null, primary key (id), unique (sessionid))
[SchemaUpdate] Incorrect syntax near the keyword 'open'.
I would have expected hibernate to use quoted identifier when creating the table.
Any ideas on how to handle this... other than renaming the field?
Had the same problem, but with a tablename called Transaction
. If you set
hibernate.globally_quoted_identifiers=true
Then all database identifiers will be quoted.
Found my answer hereSpecial character in table name hibernate giving error
And found all available settings herehttps://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/appendices/Configurations.html
Could not find better docs for this though.
这篇关于使用JPA创建具有保留字名称的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!