[Hibernate系列—] 3. 映射文件和使用SchemaExport制作自己主动Schema
自己定义映射文件
这里的映射文件指的是相应到数据库表的xml 的定义文件。
相应的每一个数据库表栏位, 能够定义的属性有:
属性名 | 类型 | Description |
---|---|---|
length | number | 栏位的长度 |
precision | number | precision表示数字中的有效位。假设没有指定precision的话。Oracle将使用38作为精度 |
scale | number | scale表示数字小数点右边的位数。scale默认设置为0. 假设把scale设成负数,Oracle将把该数字取舍到小数点左边的指定位数。 |
not-null |
|
是否为空 |
unique |
|
值是否唯一 |
index | string | The name of a multi-column index |
unique-key | string | The name of a multi-column unique constraint |
foreign-key | string | The name of the foreign key constraint generated for an association. This applies to <one-to-one>, <many-to-one>, <key>, and <many-to-many> mapping elements. inverse="true" sides are skipped by SchemaExport. |
sql-type | string | Overrides the default column type. This applies to the <column> element only. |
default | string | Default value for the column |
check | string | An SQL check constraint on either a column or atable |
设置步骤
1. 设置 映射元素的length, precision 和 scale
<property name="zip" length="5"/>
<property name="balance" precision="12" scale="2"/>
2. 设置 not-null, UNIQUE, unique-key
not-null 如为true,指名该字段不同意为null,默认false
unique 如为true,指名该字段具有唯一约束,默认false
unique-key 为多个字段设定唯一约束
<many-to-one name="bar" column="barId" not-null="true"/>
<element column="serialNumber" type="long" not-null="true" unique="true"/> <many-to-one name="org" column="orgId" unique-key="OrgEmployeeId"/>
<property name="employeeId" unique-key="OrgEmployee"/>
3. 设置 index 和 foreign-key
foreign-key 为外键约束命名,在<many-to-many><one-to-one><key><many-to-one>元素中包括
foreign-key属性,在双向关联中,inverse属性为true的一端不能设置foreign-key
ndex 给一个或多个字段建立索引
<many-to-one name="bar" column="barId" foreign-key="FKFooBar"/>
4. 设置 child 元素
当有多个数据库栏位组成一个类的属性
<property name="name" type="my.customtypes.Name"/>
<column name="last" not-null="true" index="bar_idx" length="30"/>
<column name="first" not-null="true" index="bar_idx" length="20"/>
<column name="initial"/>
</property>
5. 设置默认值
<property name="credits" type="integer" insert="false">
<column name="credits" default="10"/>
</property>
<version name="version" type="integer" insert="false">
<column name="version" default="0"/>
</version>
6. 设置 sql-type
sql-type 设定字段sql类型
<property name="balance" type="float">
<column name="balance" sql-type="decimal(13,3)"/>
</property>
7. 设置 check
check 设定sql检查约束
<property name="foo" type="integer">
<column name="foo" check="foo > 10"/>
</property>
<class name="Foo" table="foos" check="bar < 100.0">
...
<property name="bar" type="float"/>
</class>
8. 加入凝视
<class name="Customer" table="CurCust">
<comment>Current customers only</comment>
...
</class>
使用SchemaExport 工具产生数据库DDL 脚本
以
[Hibernate系列—] 1. 下载与试用Hibernate(MySQL与Oracle 配置)
这一篇的Usr.hbm.xml 为例,介绍怎样使用命名行的方式产生DDl.
cmd 到 Eclipse 创建的project的 bin 文件夹下,
运行:
java -cp .;../lib/hibernate-core-4.3.5.Final.jar;../lib/jboss-logging-3.1.3.GA.jar;../lib/jboss-transaction-api_1.2_spec-1.0.0.Final.jar;../lib/dom4j-1.6.1.jar;../lib/hibernate-commons-annotations-4.0.4.Final.jar;../lib/ojdbc14.jar;../lib/javassist-3.18.1-GA.jar;../lib/jandex-1.1.0.Final.jar;../lib/hibernate-jpa-2.1-api-1.0.0.Final.jar org.hibernate.tool.hbm2ddl.SchemaExport --config=hibernate.cfg.xml --output=my_schema.ddl
能够看到产生的 my_schema.ddl 文件的内容例如以下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxkAAAAiCAIAAAC81INbAAAKQUlEQVR4nO1dO67cOgzVUtMFabWCB7z+Ir2BLCBAulSuBkGAtwEjSJYQI3vwK/wjJR59ZjxjZeYcqLhXtimKJqVjymO5P79/pstEEARBEMRJuFwuZ6tAZOD+/P75/c055z58/q+YSw2dc873j1a2AItmo3Fo7L1zDh4uxCZlQTfk9Vka3S9dTbfL6rrO94b47eRNkJbQNtr1k8MxdLf5FUEQBAC5VPtwvz6/c29f/3z7t4ZLTdM0dA+cI3ufoSz65NSkNqYPl2DodgY1dAV0Sja4201qMnQ751Aajr0H5/8lM/dD/aQWVX71BO0SBP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AAElFTkSuQmCC" alt="" />
代码方式产生DDL脚本并运行
除了使用命令行外。 还能够使用代码的方式产生DDL 并运行这个DDL.
在bibernate.cfg.xml 配置好的前提下, 运行下面代码:
public static void main(String[] args) {
// TODO Auto-generated method stub
Configuration cfg = new Configuration().configure();
new SchemaExport(cfg).create(true, true);
}
create 方法有两个參数:
1. 第一个參数设置是否输出DDL到控制台,
假设设置成true, 在控制台就能够看到下面相似的SQL
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXQAAAEoCAIAAADHTZ2IAAAeY0lEQVR4nO2d3bmjIBRFrZl2KGE6sA6rSBPOg4oHOAchCbnBrPXNwx1CABE2P8rOtAIAdGD66wIAwD1BXACgC4gLAHQBcQGALiAuANAFxAUAuoC4AEAXEBcA6ALiAgBd+Iy4LH6aJjd/JK829pI9lI8es5umyfy4kpDKjl+uy7Nnen71qLozLe+9m5XkQ+SQUJxCGZHhC5f8Ob63Xb2dxY9yU04+NnNZ/Acbwewu+nAcuXTXHuWPa1j8KSmLr9AXmeFZb7Ikiz87VVTCx+yM+JdXIeJUlPJb+Gi7aqWpHd4g34Se4iJGVb+cjWALFSPzWRFiGN4DZzdNk5tnP1WOqdlQfqYuBnOZyuzcvJhjtiIuclJQ07KluFSoVY24aCVMu1kqOi3trTL6Im7LmZtRz6u8v845Udq2dIx21XxfrHy1drhn6pxLwq3rstuh2f6N69Vn0FZ5Cu3frv9O9BMXOVhm09etHo8J/Hb9sxPVt/h4LSDr7rrZG11jWcQNjm/2kXOWftalI6l4zO66Hcfikv5Xia6Lyxo1jjMwXz3lJa+qtbgIFZGSJn3ebrWerZlXYzpWu2q+L1a+VjvcE32k12Jd11qYQWjt36q3PJdyeax8C+XsRDdxibuInK4rn67KWBmiJBVdM6jqUWJR98aNTNJPb2qyl5ENYgrvE5foUtIZjTJzUUfCCx6zq1oT2QJk1HNcd2Kh2JSO1a6a74uRr90Oo4+iYqjXta5FcVHuiFlv4ULtLhMnaA2uVjk7MYS4pCk9JS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NyCRkmdMm8IXs5TDfqswbSoVJ7+ukMg+MxK10JZ+wf1f5B7t2taUM5ueqOHWfBMzqqEZU1zgT+j2xNhKGDOqoUFcoIH27aYKrG0yzKgGB3EBgC4gLgDQBcQFALqAuABAFxAXAOgC4gIAXUBcAKALPycu33P8dnafe/1U+jOkLxi7+TwlHZ0u2N+jTb5xWWLzzJf1Qi9+Czfl58Tlq+jyTlpO/AKsbnYVW9ot3rnzxFL0/coyK2e1ZDLxkS/Mom7JqOKyD/uzzwdUywwpjJ3pAO3cPkwv4avnh/lwbaS/x47G6asBeeuAYlDPTv+cKTyTfiiwdqo7M2Hxy34EUv69Z31tBZVwIS7fZ+gHb2dUcVn3Ti4P/mYmbJoZkmJneZ7627t6UJc2s6X4qHFNHxTiYvbkyfDBqja3TKcFutnVphmLd/Nj+4IlLu+ZuaT//Z7VKryNscUlUQ3dMynG9Mp9nMO2uj9R44eiW9cVLyHt5OmORZRza/rHVaiWEcrMJZxDjvKKy1SZb6O44OdyQ4YWl9Rh+63i8ozZUugwldOK2U3ex4Yz5e2HxvT3ohf9aM7QfXm3HKZ5+sylPtuGZRHickeGFpdozI/623vEpc1s6SiGm+faacWZVTQ9KXWzpvT3staYXWVbKZ3FJZ/GsCy6G0OLS/QrQso2bLSoyNcbfhH2SuFxyeN4RPyEmdORT+20JftRAPUS4tSq05cZGY5ZR/qJ+db5X79Ej6Kr+n/do2hF8FquCQZgbHH5xrGufjfkY+l//ZPery8gPMOo4mIaJv4dcsTu0VVeSf9LhXiDactNGVVcAODLQVygHW3nptuMDUYFcQGALiAuANAFxAUAuoC4AEAXEBcA6EJPceH9BYAfpu/MhTcvAX6WzssiJi8Av0rvPRdOuwL8KN03dPHpAPhNEBcA6ALLIgDoAhu6ANAFHkUDQBd4iQ4AusDr/wDQBcQFALqAuABAFxAXAOjCf/B87ldUFpnzAAAAAElFTkSuQmCC" alt="" />
2. 第二个參数设置是否要在Db 中运行这个SQL
版权声明:本文博客原创文章,博客,未经同意,不得转载。
[Hibernate系列—] 3. 映射文件和使用SchemaExport制作自己主动Schema的更多相关文章
- Java IDE 编辑器 --- IntelliJ IDEA 进阶篇 生成 hibernate 实体与映射文件
原文:转:Java IDE 编辑器 --- IntelliJ IDEA 进阶篇 生成 hibernate 实体与映射文件 2011-04-30 12:50 很多人不知道怎么用 IntelliJ IDE ...
- 【转】hibernate中的映射文件xxx.hbm.xml详解总结
一.Hibernate映射文件的作用: Hibernate映射文件是Hibernate与数据库进行持久化的桥梁 二,Hibernate映射文件主要内容: (1).映射内容的定义: Hibern ...
- Eclipse使用xdoclet1.2.3 生成hibernate配置文件和映射文件
用ant和xdoclet生成hibernate配置文件可以为我们省去很多配置的操作,废话不多说,直接给栗子: 测试环境: eclipse:Eclipse Java EE IDE for Web Dev ...
- Hibernate 配置文件与映射文件 总结
hibernate是一个彻底的ORM(Object Relational Mapping,对象关系映射)开源框架. 一.Hibernate配置文件详解 Hibernate配置文件有两种形式:XML与p ...
- hibernate自动生成映射文件
映射文件是O/R Mapping的关键,相当于控制中心.当数据库表较多时,手动配置该映射文件非常耗时.为了快速开发程序,使开发人员的注意力集中到业务逻辑上来,Hibernate官方提供的MiddleG ...
- hibernate多对多映射文件详解(一)
1.仓库表属性 public class WarehouseNew implements java.io.Serializable { // Fields private static final l ...
- hibernate实体类型映射文件
1.通过写hibernate映射文件.实体类型转换为数据库中的表 据实体类型而写的. 实体类型User.java package cn.wwh.www.hibernate.dd.property; i ...
- Hibernate 对象关系映射文件
简介: POJO 类和关系型数据库之间的映射可以用一个 XML 文档来定义 通过 POJO 类的数据库映射文件,Hibernate 可以理解持久化类和数据表之间的对应关系,也可以理解持久化类属性与数据 ...
- hibernate之xml映射文件关系维护,懒加载,级联
一:关系维护 --->inverse默认值false,表示不放弃关系的维护. --->inverse="true"配置在那一端,表示那一端xml对应的po放弃关系的 ...
随机推荐
- 小米笔记本(13.3 I7) ubuntu14.04下网卡驱动安装
ubuntu 内核升级到4.6.4(更高版本可能造成系统无法启动) kernel debian包下载地址 http://kernel.ubuntu.com/~kernel-ppa/mainline/v ...
- div宽度设置width:100%后再设置padding或margin超出父元素的解决办法
div宽度设置width:100%后再设置padding或margin超出父元素的解决办法 一.总结 一句话总结:直接加上box-sizing:border-box;即可解决上述问题. 1.box-s ...
- 我的前端规范——JavaScript篇
相关文章 简书原文:https://www.jianshu.com/p/5918c283cdc3 我的前端规范——开篇:http://www.cnblogs.com/shcrk/p/9271561.h ...
- php实现 字符个数统计
php实现 字符个数统计 一.总结 一句话总结: 1.php字符转ascii码函数? ord() 6 if(ord($input[$i]) < 128 and 0 < ord($input ...
- 【22.17%】【codeforces718B】 Efim and Strange Grade
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- tspitr(tablespace point in time recovery)实验
===========环境模拟================= -----------模拟数据---------------- SYS@ORCL>create tablespace test ...
- 让Apache 和nginx支持跨域訪问
1,怎样让Apache支持跨域訪问呢? 步骤: 改动httpd.conf,windows中相应的文件夹是:C:\wamp\bin\apache\Apache2.4.4\conf\httpd.conf ...
- 资源载入和页面事件 load, ready, DOMContentLoaded等
资源载入和页面事件 理想的页面载入方式 解析HTML结构. 载入并解析外部脚本. DOM树构建完成,运行脚本.//DOMInteractive –> DOMContentLoaded 载入图片. ...
- mysqldump --single-transaction 和--lock-tables参数详解
mysqldump的备份原理 mysqldump在备份过程中,是采用查询备份相关表的数据,然后导出,拼接成insert语句的形式进行备份. 关于--single-transaction 和--lo ...
- SpringMVC3,使用RequestMappint的Param参数,实现一个url绑定多个方法
SpringMVC中,默认不能把多个相同的url绑定到同一个方法.如果需要绑定,需要增加param参数,而且值要不同. 我自己没有这个需求,或者就是有需求,我也想到的是使用不同的url. 项目中有少部 ...