hibernate处理数据库中text类型
来源:互联网 发布:hadoop处理100万数据 编辑:程序博客网 时间:2024/06/15 17:59
hibernate默认不支持text类型的,所以要修改方言源代码
<span style="font-family:KaiTi_GB2312;font-size:18px;"><bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource"><ref bean="dataSource" /></property><property name="hibernateProperties"><props><prop key="hibernate.dialect"> my.util.MyDialect<!-- org.hibernate.dialect.MySQLDialect--></prop><prop key="hibernate.show_sql">${jdbc.show_sql}</prop><prop key="hibernate.format_sql">true</prop><!-- 批处理 --><prop key="hibernate.jdbc.batch_size">5</prop><!-- 开启缓存 --><prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop><prop key="cache.use_second_level_cache">true</prop></props></property><property name="mappingResources"><list><value>my/models/business/common/OvertimeDetail.hbm.xml</value> <value>my/models/business/common/WorkOvertime.hbm.xml</value></list> </property></bean></span>
<span style="font-family:KaiTi_GB2312;font-size:18px;">package my.util;import java.sql.Types;import org.hibernate.Hibernate;import org.hibernate.dialect.MySQL5Dialect;import org.hibernate.dialect.function.SQLFunctionTemplate;public class MyDialect extends MySQL5Dialect { public MyDialect(){ super(); registerHibernateType(Types.LONGVARCHAR, Hibernate.TEXT.getName()); registerFunction("convert", new SQLFunctionTemplate(Hibernate.STRING, "convert(?1 using gbk)")); } @Override public String getTableTypeString() { return "engine=MyISAM"; } } </span>
0 0
- hibernate处理数据库中text类型
- hibernate 中 对数据库中datetime类型的处理
- hibernate 中 对数据库中datetime类型的处理
- 处理Hibernate中Pojo对象String属性不能映射Sqlserver2005 text类型字段问题
- 处理Hibernate中Pojo对象String属性不能映射Sqlserver2005 text类型字段问题 .
- mysql数据库中text类型长度
- Hibernate注解映射mysql数据库上text类型
- SQL text类型处理
- SQL中ntext、text 或 image 类型数据的处理
- Hibernate 读取TEXT IMAGE类型
- Hibernate text类型 注解问题
- Hibernate3对Mysql数据库中Text类型字段的支持
- hibernate对oracle数据库CLOB、blob类型字段处理原则
- 数据库中大字段类型处理
- 记录一下:Hibernate配置文件中数据库字段的对应类型
- MSSQL数据库中Text类型字段在PHP中被截断之解
- SQL Server中TEXT类型字段值在数据库中追加字符串方法
- hibernate 数据库关键字处理
- 任意语言,任意大小,任意字体,任意格式,任意范围,任意字符,任意扫描方式取模,生成字节,UNICODE_Font_宋体16_ 纵向取模下高位_数据排列_从左到右从上到下
- xcode git 忽略user interface state文件
- RTS设计
- matlab下libsvm的配置使用
- 使用Auto Layout中的VFL(Visual format language)--代码实现自动布局
- hibernate处理数据库中text类型
- 使用CSplitterWnd分割View窗口
- 矩阵乘法cache优化
- download as400 data to excel
- Spring实现零配置的方式(二)
- pom.xml详解(里面详细介绍个每个标签的作用)
- C++ -- 基本数据类型的表现形式
- Android图片滚动,加入自动播放功能,使用自定义属性实现,霸气十足!
- 【C语言】[文件]:文件读写相关