对于teradata数据库,Hibernate @formula不支持将Cast()作为int
发布时间:2021-01-24 10:09:33 所属栏目:MsSql教程 来源:网络整理
导读:我在用 @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(ite
我在用 @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会工作. (编辑:开发网_郴州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 佳能RF35mm F1.8 MACRO微距镜头促销
- sql-server – EF Code First对所有字符串使用nvarchar(max
- HTML表格标记教程(43):表头的垂直对齐属性VALIGN
- sql-server-2008 – “无法找到存储过程”,即使已在MS SQL
- 使用Internals Viewer插件查看SQL SERVER内部数据页面
- sql-server – 我的SQL Server是否已修补?
- sql – 删除主键行,这是另一个表的外键
- 重大恶性病毒“超级密码杀手”最新变种网上蔓延
- 在SQL Server存储过程中按索引而不是名称访问表的列
- SQL Server 2008中的数据压缩功能