分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

Hibernate3映射数据类型

发布时间:2023-09-06 02:24责任编辑:傅花花关键词:Hibernate数据类型

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.itcast.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()的区别

Hibernate3映射数据类型

原文地址:https://www.cnblogs.com/loaderman/p/10037083.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved