hibernate 中的方言与数据库中的数据类型不对应问题
来源:互联网 发布:java mina框架 编辑:程序博客网 时间:2024/04/24 16:15
hibernate 中的方言与数据库中的数据类型不对应问题
有时候会遇到 hibernate no mapping Dialect type -9 之类的,这个就是方言与数据库中的数据类型不对应问题 ,那先说一下解决思路
解决思路
- 换方言
-数据库中表类型换了
-继承hibernate 中的方言,重写hibernate 的数据类型对应关系
在第一个方法不可以的情况下,第二个显然是最好的解决方法!
import org.hibernate.dialect.SQLServerDialect;/** * 自定义方言的类,用于解决hibernate中方言与数据库不类型不对的问题 */public class SqlServer2008Dialect extends SQLServerDialect { public SqlServer2008Dialect() { super(); registerHibernateType(1, "string"); registerHibernateType(-9, "string"); registerHibernateType(-16, "string"); registerHibernateType(3, "double"); }}
最后在改写一下hibernate 中方言类的配置就可以了!
0 0
- hibernate 中的方言与数据库中的数据类型不对应问题
- 数据库在hibernate中的方言
- 【Hibernate】Hibernate中的数据库方言(Dialect)
- Hibernate中的数据库方言(Dialect)
- Hibernate xml配置中的数据库方言
- Hibernate中的数据库方言(Dialect)
- Hibernate中的数据库方言(Dialect)
- Hibernate中的数据库方言(Dialect)
- Hibernate中的数据库方言(Dialect)
- Hibernate中的数据库方言(Dialect)
- Hibernate中的数据库方言(Dialect)
- Hibernate中的数据库方言(Dialect)
- Hibernate 配置文件中的方言
- 关于配置文件中的头约束问题 xsd 版本不对应
- Hibernate Dialect.数据库方言问题
- Hibernate数据库方言选择问题
- hibernate中的一些方言的写法
- 查询数据库中的表,返回字段相对应的数据类型!
- 如何在mac OS 系统中用Terminal实现C语言重定向
- SpringMVC源码 HandlerMapping和HandlerAdapter(2)
- jenkins调整jdk版本不生效的解决办法
- java 图片上传
- Matlab xml读写
- hibernate 中的方言与数据库中的数据类型不对应问题
- EFI VMware Virtual SCSI Hard Drive(0,0) unsuccessful
- HTTP协议中GET、POST和HEAD的介绍
- Java源码打包成可运行JAR:Eclipse实现
- 学习记录--使用 F12 开发人员工具调试 HTML 和 CSS
- Jenkins进阶系列之——16一个完整的JENKINS下的ANT BUILD.XML文件
- 翻译QSetting的用法
- Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程
- Bzoj3992:[SDOI2015]序列统计:NTT+DP