gpt4 book ai didi

java - HSQLDB 带有 mssql 关键字表名

转载 作者:行者123 更新时间:2023-12-01 15:22:12 30 4
gpt4 key购买 nike

我正在尝试将所有junit测试切换到hsqldb(真正的数据库是oracle)。当我尝试映射包含以下内容的 .hbm.xml 文件时出现问题:

<property name="begin" type="integer" column="BEGIN" /> <property name="end" type="integer" column="END" />

现在在内存数据库构建期间我得到以下信息:

ERROR - Unsuccessful: create table BLOCKTIME (ID bigint not null, BEGIN integer, END integer, TIMEZONE varchar(255), primary key (ID))ERROR - Unexpected token: END in statement [create table BLOCKTIME (ID bigint not null, BEGIN integer, END]

问题似乎是 BEGIN 和 END 表名称被限制为 mssql 作为关键字。

知道如何忽略这个问题吗?

谢谢,马雷克。

最佳答案

您可以转义列名称:

<property name="begin" type="integer" >
<column name="[begin]" />
</property>

或者

<property name="begin" type="integer" >
<column name='"begin"' />
</property>

关于java - HSQLDB 带有 mssql 关键字表名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10738583/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com