加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程 > 正文

对付teradata数据库,Hibernate @formula不支持将Cast()作为int

发布时间:2021-01-24 07:46:24 所属栏目:编程 来源:网络整理
导读:我在用 @Formula("cast(item_code as "int")") 将String列逼迫转换为int 可是hibernate正在天生查询 and cast(this_.item_code as this_."int")=? 我怎样挣脱int前面的别名? 我试过了 : @Formula(“cast(item_code as”int“)”)和@Formula(“cast(item_c

我在用

@Formula("cast(item_code as "int")")

将String列逼迫转换为int

可是hibernate正在天生查询

and cast(this_.item_code as this_."int")=?

我怎样挣脱int前面的别名?

我试过了 :

@Formula(“cast(item_code as”int“)”)和@Formula(“cast(item_code as int)”)

但如故是同样的错误.怎样将String转换为int?

提前叩谢 .

办理要领

我已包办理了与你相同的题目.我为我的数据库扩展了hibernate Dialect类.
public class Oracle10gDialectExtended extends Oracle10gDialect {

    public Oracle10gDialectExtended() {
        super();
        /* types for cast: */
        registerKeyword("int");
        // add more reserved words as you need
    }
}

行使这个新类配置’hibernate.dialect’属性.此刻你的@Formula会事变.

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读