zoukankan      html  css  js  c++  java
  • Hibernate3映射数据类型

    1. 在实际开发中需要在hbm文件中使用的type属性值是指定的类型。那
        么指定的类型一般的是基于hibernate的类型。
    2. 当然在实际过程中也可以在hbm文件中指定java类型。

    public class DataType {
        private long id;        private boolean tag;              private Date createDate;
        private char vip;      private Timestamp logTime;   private byte[] description;
        ….
    }
    <hibernate-mapping>
        <class name="cn.loaderman.hibernate.datatype.DataType" table="datatype">
         <id name="id" column="id" type="long">
           <generator class="increment"></generator>
         </id>
         <property name="tag" column="tag" type="boolean"></property>
         <property name="createDate" column="createDate" type="date"></property>
         <property name="vip" column="vip" type="character"></property>
         <property name="logTime" column="logTime" type="timestamp"></property>
         <property name="description" column="description" type="binary"></property>
      </class>
    </hibernate-mapping>
    流类型
         FileInputStream in = new FileInputStream(new File("测试文档.txt"));
         int length = in.available();
         byte[] b = new byte[length];
         in.read(b);
    时间戳类型
          new Timestamp(System.currentTimeMillis())
    查询的排序
          session.createQuery("from DataType as d order by d.id asc");
    分页
          query.setFirstResult(2);      query.setMaxResults(2);
    方法比较
          list()/iterator()的区别
  • 相关阅读:
    MyEclipse:详细使用教程
    JDK安装与配置详细图文教程
    windows下python3.6版本安装pygame
    windows下如何下载并安装Python
    python的 del 函数是删对象还是删引用
    python strip()函数的用法
    python的垃圾回收机制
    python中的sort方法
    python中del函数的垃圾回收
    两个数交换
  • 原文地址:https://www.cnblogs.com/loaderman/p/10037083.html
Copyright © 2011-2022 走看看