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()的区别
  • 相关阅读:
    BZOJ1042: [HAOI2008]硬币购物
    BZOJ1089: [SCOI2003]严格n元树
    BZOJ1060: [ZJOI2007]时态同步
    BZOJ2697: 特技飞行
    BZOJ2464: 中山市选[2009]小明的游戏
    BZOJ1430: 小猴打架
    BZOJ3675: [Apio2014]序列分割
    BZOJ2453: 维护队列
    BZOJ2120: 数颜色
    BZOJ4547: Hdu5171 小奇的集合
  • 原文地址:https://www.cnblogs.com/loaderman/p/10037083.html
Copyright © 2011-2022 走看看