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()的区别
  • 相关阅读:
    JVM概论
    设计模式之工厂模式
    Java基础之多线程简述
    设计模式之单例模式
    设计模式之模板方法模式
    设计模式之适配器模式
    设计模式之策略模式
    机器学习浅析之最优解问题(二)
    MapReduce架构与生命周期
    Hadoop系列之实验环境搭建
  • 原文地址:https://www.cnblogs.com/loaderman/p/10037083.html
Copyright © 2011-2022 走看看