第一部分 NHibernate 映射
上一页
下一页
第一部分 NHibernate 映射
目录
4. O/R Mapping基础
映射声明(Mapping declaration)
Schema
hibernate-mapping
class
id
联合ID(composite-id)
识别器(discriminator)
版本(version)(可选)
时间戳(timestamp )(可选)
property
多对一(many-to-one)
一对一(one-to-one)
组件(component)
子类(subclass)
连接的子类(joined-subclass)
map, set, list, bag
引用(import)
NHibernate的类型
实体(Entities)和值(values)
基本值类型
自定义值类型
映射到"任意"(any)类型
SQL中引号包围的标识符
映射文件的模块化(Modular mapping files)
5. 集合类(Collections)映射
持久化集合类(Persistent Collections)
映射集合(Mapping a Collection)
值集合和多对多关联(Collections of Values and Many-To-Many Associations)
一对多关联(One-To-Many Associations)
延迟初始化(延迟加载)(Lazy Initialization)
集合排序(Sorted Collections)
使用<idbag>
双向关联(Bidirectional Associations)
三重关联(Ternary Associations)
异类关联(Heterogeneous Associations)
集合例子
6. 关联映射
简介
单向关联
多对一(many to one)
一对一(one to one)
一对多(one to many)
使用表连接的单向关联
一对多(one to many)
多对一(many to one)
一对一(one to one)
多对多(many to many)
双向关联
一对多(one to many) /
多对一(many to one)
一对一(one to one)
使用表连接的双向关联
一对多(one to many)
/
多对一(many to one)
一对一(one to one)
多对多(many to many)
7. 示例: Parent/Child
关于collections
双向的一对多关系(Bidirectional one-to-many)
级联生命周期(Cascading lifecycle)
级联更新(Using cascading
update()
)
结论