首页 | 互联网 | IT动态 | Cisco | Windows | Linux | Java | .Net | Oracle | 华为 | 存储世界 | 服务器 | 网络设备 | IDC | 安全 | 求职招聘
IT培训 | 数字网校 | 技术专题 | 电子书下载 | 教学视频 | 网页设计 | 平面设计 | 解决方案 | 直播室 | 虚拟考场 | 搜索 | 博客 | 沙龙 | 论坛
中国IT实验室Linux频道
中国IT教育
 
首页 资讯动态 认证考试 新手入门 核心技术 高级技术 J2EE J2ME Java&XML 开源技术 其他技术 RSS订阅 论坛 专题
您现在的位置: 中国IT实验室 >> Java >> 开源技术 >> Hibernate >> 文章正文

Hibernate+Spring搞定Clob、Blob的存取

文章来源51cto博客 作者熔岩 更新时间2008-5-11 保存本文保存本文 推荐给好友推荐给好友 收藏本页收藏本页

    二、通过XDoclet生成Mapping,并修正lob映射的类型为Spring提供的类型

    <?xml version="1.0" encoding="gb2312"?>

    <!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

    <hibernate-mapping
            default-lazy="false"
    >
        <class
            name="com.topsoft.oa.routine.domain.office.entity.WorkNote"
            table="rc_gzrz"
        >
            <meta attribute="class-description">工作日志</meta>

            <id
                name="id"
                column="BS"
                type="java.lang.Long"
            >
                <meta attribute="field-description">标识</meta>
                <generator class="sequence">
                    <param name="sequence">SEQ_GW</param>
                  <!--
                      To add non XDoclet generator parameters, create a file named
                      hibernate-generator-params-WorkNote.xml
                      containing the additional parameters and place it in your merge dir.
                  -->
                </generator>
            </id>

            <property
                name="workDate"
                type="timestamp"
                update="true"
                insert="true"
                column="workDate"
                not-null="false"
            >
                <meta attribute="field-description">工作日期</meta>
            </property>

            <property
                name="weather"
                type="java.lang.String"
                update="true"
                insert="true"
                column="weather"
                length="24"
                not-null="false"
            >
                <meta attribute="field-description">天气</meta>
            </property>

            <property
                name="content"
                type="org.springframework.orm.hibernate3.support.ClobStringType"
                update="true"
                insert="true"
                column="content"
                not-null="false"
            >
                <meta attribute="field-description">内容</meta>
            </property>

            <property
                name="state"
                type="java.lang.String"
                update="true"
                insert="true"
                column="state"
                length="2"
                not-null="false"
            >
                <meta attribute="field-description">状态</meta>
            </property>

            <property
                name="orgId"
                type="long"
                update="true"
                insert="true"
                column="orgId"
            >
                <meta attribute="field-description">机构id</meta>
            </property>

            <property
                name="userId"
                type="long"
                update="true"
                insert="true"
                column="userId"
            >
                <meta attribute="field-description">用户id</meta>
            </property>

            <property
                name="createDate"
                type="timestamp"
                update="true"
                insert="true"
                column="createDate"
                not-null="false"
            >
                <meta attribute="field-description">创建日期</meta>
            </property>

            <property
                name="image"
                type="org.springframework.orm.hibernate3.support.BlobByteArrayType"
                update="true"
                insert="true"
                column="image"
                not-null="false"
            >
                <meta attribute="field-description">图片</meta>
            </property>

            <!--
                To add non XDoclet property mappings, create a file named
                    hibernate-properties-WorkNote.xml
                containing the additional properties and place it in your merge dir.
            -->

        </class>

    </hibernate-mapping>

上一页  [1] [2] [3] [4] 下一页  

【责编:Ken】

中国IT教育

相关产品和培训
文章评论
 友情推荐链接
 认证培训
 专题推荐

 ·关于Java框架技术专题
 ·XML全攻略技术专题
 ·JAVA开源技术介绍专题
 ·Java嵌入式开发之J2ME技术专题
 ·超前体验 Oracle 11g的5个新特性
 ·揭密使用VB.NET的五个实用技巧
 ·Oracle和SQL Server常用函数对比专题
 ·展现C#世界 C#程序设计专题
 ·Java入门 Tomcat的配置技巧精华专题
 ·Oracle RMAN物理备份技术详解
 今日更新
 社区讨论
 博客论点
 频道精选
 Java 频道导航