HIBERNATE - 符合Java习惯的关系数据库持久化

Hibernate参考文档

3.0.4


目录

前言
1. 翻译说明
2. 版权声明
1. 在Tomcat中快速上手
1.1. 开始Hibernate之旅
1.2. 第一个持久化类
1.3. 映射cat
1.4. 与Cat同乐
1.5. 结语
2. Hibernate入门
2.1. 前言
2.2. 第一部分 - 第一个Hibernate程序
2.2.1. 第一个class
2.2.2. 映射文件
2.2.3. Hibernate配置
2.2.4. 用Ant编译
2.2.5. 安装和帮助
2.2.6. 加载并存储对象
2.3. 第二部分 - 关联映射
2.3.1. 映射Person类
2.3.2. 一个单向的Set-based关联
2.3.3. 使关联工作
2.3.4. 值类型的集合
2.3.5. 双向关联
2.3.6. 使双向关联工作
2.4. 总结
3. 体系结构(Architecture)
3.1. 概况(Overview)
3.2. 实例状态
3.3. JMX整合
3.4. 对JCA的支持
4. 配置
4.1. 可编程的配置方式
4.2. 获得SessionFactory
4.3. JDBC连接
4.4. 可选的配置属性
4.4.1. SQL方言
4.4.2. 外连接抓取(Outer Join Fetching)
4.4.3. 二进制流 (Binary Streams)
4.4.4. 二级缓存与查询缓存
4.4.5. 查询语言中的替换
4.4.6. Hibernate的统计(statistics)机制
4.5. 日志
4.6. 实现NamingStrategy
4.7. XML配置文件
4.8. J2EE应用程序服务器的集成
4.8.1. 事务策略配置
4.8.2. JNDI绑定的SessionFactory
4.8.3. JTA和Session的自动绑定
4.8.4. JMX部署
5. 持久化类(Persistent Classes)
5.1. 一个简单的POJO例子
5.1.1. 为持久化字段声明访问器(accessors)和是否可变的标志(mutators)
5.1.2. 实现一个默认的(即无参数的)构造方法(constructor)
5.1.3. 提供一个标识属性(identifier property)(可选)
5.1.4. 使用非final的类 (可选)
5.2. 实现继承(Inheritance)
5.3. 实现equals()和hashCode()
5.4. 动态模型(Dynamic models)
6. 对象/关系数据库映射基础(Basic O/R Mapping)
6.1. 映射定义(Mapping declaration)
6.1.1. Doctype
6.1.2. hibernate-mapping
6.1.3. class
6.1.4. id
6.1.4.1. Generator
6.1.4.2. 高/低位算法(Hi/Lo Algorithm)
6.1.4.3. UUID算法(UUID Algorithm )
6.1.4.4. 标识字段和序列(Identity columns and Sequences)
6.1.4.5. 程序分配的标识符(Assigned Identifiers)
6.1.4.6. 触发器实现的主键生成器(Primary keys assigned by triggers)
6.1.5. composite-id
6.1.6. 鉴别器(discriminator)
6.1.7. 版本(version)(可选)
6.1.8. timestamp (optional)
6.1.9. property
6.1.10. 多对一(many-to-one)
6.1.11. 一对一
6.1.12. 组件(component), 动态组件(dynamic-component)
6.1.13. properties
6.1.14. 子类(subclass)
6.1.15. 连接的子类(joined-subclass)
6.1.16. 联合子类(union-subclass)
6.1.17. 连接(join)
6.1.18. 键(key)
6.1.19. 字段和规则元素(column and formula elements)
6.1.20. 引用(import)
6.1.21. any
6.2. Hibernate 的类型
6.2.1. 实体(Entities)和值(values)
6.2.2. 基本值类型
6.2.3. 自定义值类型
6.3. SQL中引号包围的标识符
6.4. 其他元数据(Metadata)
6.4.1. 使用 XDoclet 标记
6.4.2. 使用 JDK 5.0 的注解(Annotation)
7. 集合类(Collections)映射
7.1. 持久化集合类(Persistent collections)
7.2. 集合映射( Collection mappings )
7.2.1. 集合外键(Collection foreign keys)
7.2.2. 集合元素(Collection elements)
7.2.3. 索引集合类(Indexed collections)
7.2.4. 值集合于多对多关联(Collections of values and many-to-many associations)
7.2.5. 一对多关联(One-to-many Associations)
7.3. 高级集合映射(Advanced collection mappings)
7.3.1. 有序集合(Sorted collections)
7.3.2. 双向关联(Bidirectional associations)
7.3.3. 三重关联(Ternary associations)
7.3.4. 使用<idbag>
7.4. 集合例子(Collection example)
8. 关联关系映射
8.1. 介绍
8.2. 单向关联(Unidirectional associations)
8.2.1. 多对一(many to one)
8.2.2. 一对一(one to one)
8.2.3. 一对多(one to many)
8.3. 使用连接表的单向关联(Unidirectional associations with join tables)
8.3.1. 一对多(one to many)
8.3.2. 多对一(many to one)
8.3.3. 一对一(one to one)
8.3.4. 多对多(many to many)
8.4. 双向关联(Bidirectional associations)
8.4.1. 一对多(one to many) / 多对一(many to one)
8.4.2. 一对一(one to one)
8.5. 使用连接表的双向关联(Bidirectional associations with join tables)
8.5.1. 一对多(one to many) /多对一( many to one)
8.5.2. 一对一(one to one)
8.5.3. 多对多(many to many)
9. 组件(Component)映射
9.1. 依赖对象(Dependent objects)
9.2. 在集合中出现的依赖对象
9.3. 组件作为Map的索引(Components as Map indices )
9.4. 组件作为联合标识符(Components as composite identifiers)
9.5. 动态组件 (Dynamic components)
10. 继承映射(Inheritance Mappings)
10.1. 三种策略
10.1.1. 每个类分层结构一张表(Table per class hierarchy)
10.1.2. 每个子类一张表(Table per subclass)
10.1.3. 每个子类一张表(Table per subclass),使用辨别标志(Discriminator)
10.1.4. 混合使用“每个类分层结构一张表”和“每个子类一张表”
10.1.5. 每个具体类一张表(Table per concrete class)
10.1.6. Table per concrete class, using implicit polymorphism
10.1.7. 隐式多态和其他继承映射混合使用
10.2. 限制
11. 与对象共事
11.1. Hibernate对象状态(object states)
11.2. 使对象持久化
11.3. 装载对象
11.4. 查询
11.4.1. 执行查询
11.4.1.1. 迭代式获取结果(Iterating results)
11.4.1.2. 返回元组(tuples)的查询
11.4.1.3. 标量(Scalar)结果
11.4.1.4. 绑定参数
11.4.1.5. 分页
11.4.1.6. 可滚动遍历(Scrollable iteration)
11.4.1.7. 外置命名查询(Externalizing named queries)
11.4.2. 过滤集合
11.4.3. 条件查询(Criteria queries)
11.4.4. 使用原生SQL的查询
11.5. 修改持久对象
11.6. 修改脱管(Detached)对象
11.7. 自动状态检测
11.8. 删除持久对象
11.9. 在两个不同数据库间复制对象
11.10. Session刷出(flush)
11.11. 传播性持久化(transitive persistence)
11.12. 使用元数据
12. 事务和并发
12.1. Session和事务范围(transaction scopes)
12.1.1. 操作单元(Unit of work)
12.1.2. 应用程序事务(Application transactions)
12.1.3. 关注对象标识(Considering object identity)
12.1.4. 常见问题
12.2. 数据库事务声明
12.2.1. 非托管环境
12.2.2. 使用JTA
12.2.3. 异常处理
12.3. 乐观并发控制(Optimistic concurrency control)
12.3.1. 应用程序级别的版本检查(Application version checking)
12.3.2. 长生命周期session和自动版本化
12.3.3. 脱管对象(deatched object)和自动版本化
12.3.4. 定制自动版本化行为
12.4. 悲观锁定(Pessimistic Locking)
13. 拦截器与事件(Interceptors and events)
13.1. 拦截器(Interceptors)
13.2. 事件系统(Event system)
13.3. Hibernate的声明式安全机制
14. 批量处理(Batch processing)
14.1. 批量插入(Batch inserts)
14.2. 批量更新(Batch updates)
14.3. 大批量更新/删除(Bulk update/delete)
15. HQL: Hibernate查询语言
15.1. 大小写敏感性问题
15.2. from子句
15.3. 关联(Association)与连接(Join)
15.4. select子句
15.5. 聚集函数
15.6. 多态查询
15.7. where子句
15.8. 表达式
15.9. order by子句
15.10. group by子句
15.11. 子查询
15.12. HQL示例
15.13. 批量的UPDATE & DELETE语句
15.14. 小技巧 & 小窍门
16. 条件查询(Criteria Queries)
16.1. 创建一个Criteria 实例
16.2. 限制结果集内容
16.3. 结果集排序
16.4. 关联
16.5. 动态关联抓取
16.6. 查询示例
16.7. 投影(Projections)、聚合(aggregation)和分组(grouping)
16.8. 离线(detached)查询和子查询
17. Native SQL查询
17.1. 创建一个基于SQL的Query
17.2. 别名和属性引用
17.3. 命名SQL查询
17.3.1. 使用return-property来明确地指定字段/别名
17.3.2. 使用存储过程来查询
17.3.2.1. 使用存储过程的规则和限制
17.4. 定制SQL用来create,update和delete
17.5. 定制装载SQL
18. 过滤数据
18.1. Hibernate 过滤器(filters)
19. XML映射
19.1. 用XML数据进行工作
19.1.1. 指定同时映射XML和类
19.1.2. 只定义XML映射
19.2. XML映射元数据
19.3. 操作XML数据
20. 提升性能
20.1. 抓取策略(Fetching strategies)
20.1.1. 操作延迟加载的关联
20.1.2. 调整抓取策略(Tuning fetch strategies)
20.1.3. 单端关联代理(Single-ended association proxies)
20.1.4. 实例化集合和代理(Initializing collections and proxies)
20.1.5. 使用批量抓取(Using batch fetching)
20.1.6. 使用子查询抓取(Using subselect fetching)
20.1.7. 使用延迟属性抓取(Using lazy property fetching)
20.2. 二级缓存(The Second Level Cache)
20.2.1. 缓存映射(Cache mappings)
20.2.2. 策略:只读缓存(Strategy: read only)
20.2.3. 策略:读/写缓存(Strategy: read/write)
20.2.4. 策略:非严格读/写缓存(Strategy: nonstrict read/write)
20.2.5. 策略:事务缓存(transactional)
20.3. 管理缓存(Managing the caches)
20.4. 查询缓存(The Query Cache)
20.5. 理解集合性能(Understanding Collection performance)
20.5.1. 分类(Taxonomy)
20.5.2. Lists, maps 和sets用于更新效率最高
20.5.3. Bag和list是反向集合类中效率最高的
20.5.4. 一次性删除(One shot delete)
20.6. 监测性能(Monitoring performance)
20.6.1. 监测SessionFactory
20.6.2. 数据记录(Metrics)
21. 工具箱指南
21.1. Schema自动生成(Automatic schema generation)
21.1.1. 对schema定制化(Customizing the schema)
21.1.2. 运行该工具
21.1.3. 属性(Properties)
21.1.4. 使用Ant(Using Ant)
21.1.5. 对schema的增量更新(Incremental schema updates)
21.1.6. 用Ant来增量更新schema(Using Ant for incremental schema updates)
22. 示例:父子关系(Parent Child Relationships)
22.1. 关于collections需要注意的一点
22.2. 双向的一对多关系(Bidirectional one-to-many)
22.3. 级联生命周期(Cascading lifecycle)
22.4. 级联与未保存值(Cascades and unsaved-value)
22.5. 结论
23. 示例:Weblog 应用程序
23.1. 持久化类
23.2. Hibernate 映射
23.3. Hibernate 代码
24. 示例:复杂映射实例
24.1. Employer(雇主)/Employee(雇员)
24.2. Author(作家)/Work(作品)
24.3. Customer(客户)/Order(订单)/Product(产品)
24.4. 杂例
24.4.1. "Typed" one-to-one association
24.4.2. Composite key example
24.4.3. Content based discrimination
24.4.4. Associations on alternate keys
25. 最佳实践(Best Practices)