用来声明Hibernate描述文件的Tags:
Class层次Tags
@hibernate.joined-subclass-key
方法层次Tags
@hibernate.collection-composite-element
@hibernate.collection-many-to-many
@hibernate.collection-one-to-many
@hibernate.collection-jcs-cache
字段层次Tags
Tag用法, Class层次(@hibernate)
声明一个持久类
参数 | 类型 | 适用性 | 描述 | 是否必须 |
table | text |
| 数据表名 | false |
discriminator-value | text |
| 一个用于区分特殊子类的值 | false |
mutable | bool |
| 指定该类的实例是否mutable:true/false | false |
dynamic-update | bool |
| 指定只有改变了的字段出现在SQL UPDATE中 | false |
dynamic-insert | bool |
| 指定null字段不应出现在SQL INSERT | false |
polymorphism | text |
| 使"explicit"多态性有效 可选项: explicit implicit | false |
schema | text |
| 覆盖schema在hibernate-mapping根元素中指定的名称 | false |
proxy | text |
| 为使用CGLIB proxies指定一个接口 | false |
声明当前类为子类
参数 | 类型 | 适用性 | 描述 | 是否必须 |
discriminator-value | text |
| 一个用于区分特殊子类的值 | false |
proxy | text |
| 为使用CGLIB proxies指定一个接口 | false |
dynamic-update | bool |
| 指定只有改变了的字段出现在SQL UPDATE中 | false |
dynamic-insert | bool |
| 指定null字段不应出现在SQL INSERT | false |
@hibernate.discriminator (0..1)
Defines a discriminator
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | true |
type | text |
| Hibernate 类型 | false |
length | text |
| 映射字段的长度 | false |
@hibernate.joined-subclass (0..1)
Declare the current class as joined subclass
参数 | 类型 | 适用性 | 描述 | 是否必须 |
proxy | text |
| 为使用CGLIB proxies指定一个接口 | false |
dynamic-update | bool |
| 指定只有改变了的字段出现在SQL UPDATE中 | false |
dynamic-insert | bool |
| 指定null字段不应出现在SQL INSERT | false |
schema | text |
| 覆盖schema在hibernate-mapping根元素中指定的名称 | false |
@hibernate.joined-subclass-key (0..1)
Declares a joined-subclass key
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | true |
Enables caching
参数 | 类型 | 适用性 | 描述 | 是否必须 |
usage | text |
| 定义缓冲语义 可选项: read-write nonstrict-read-write read-only | true |
Enables caching (deprecated)
参数 | 类型 | 适用性 | 描述 | 是否必须 |
usage | text |
| 定义缓冲语义. nonstrict-read-write只应用于版本2.0或者更新的版本. 可选项: read-write nonstrict-read-write read-only | true |
为类声明一个有名称的查询
参数 | 类型 | 适用性 | 描述 | 是否必须 |
name | text |
| 查询的名称 | true |
query | text |
| 查询的内容 | true |
Tag Usage, Method Level (@hibernate)
定义一个id属性
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | false |
type | text |
| Hibernate 类型 | false |
length | text |
| 所应设数据库表字段的长度 | false |
unsaved-value | text |
| 一个用来从新的transient instances中区分transient instances和已存在的persistent状态的值 | false |
generator-class | text |
| key generator类 可选项: uu id.hex uuid.string increment assigned native identity sequence hilo seqhilo foreign | true |
@hibernate.generator-param (0..*)
指定id generator 参数和值
参数 | 类型 | 适用性 | 描述 | 是否必须 |
name | text |
| 参数名称 | true |
value | text |
| 参数值 | true |
定义一个property
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | false |
type | text |
| Hibernate 类型 | false |
length | text |
| 所应设数据库表字段的长度 | false |
not-null | bool |
| 字段是否可以为null | false |
unique | bool |
| 字段是否unique | false |
insert | bool |
| 字段是否应该出现在SQL INSERT中 | false |
update | bool |
| 字段是否应该出现在SQL UPDATE中 | false |
声明一个component
参数 | 类型 | 适用性 | 描述 | 是否必须 |
class | text |
| 特定类的全名 | false |
Declares a version property
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 存放版本号的字段名称 | false |
Type | text |
| Hibernate 类型 可选项: integer short long timestamp calendar | false |
Declares a timestamp property
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 存放timestamp的字段名称 | false |
声明一个many-to-one 关系
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | false |
class | text |
| 关系类名称 | false |
cascade | text |
| 指定从父对象到关联对象有哪些级联操作 可选项: all none save-update delete | false |
not-null | bool |
| 字段是否可以为null | false |
unique | bool |
| 字段是否unique | false |
outer-join | text |
| 使outer-join fetching有效 可选项: true false auto | false |
insert | bool |
| 字段是否应该出现在SQL INSERT中 | false |
update | bool |
| 字段是否应该出现在SQL UPDATE中 | false |
Declares a one-to-one association
参数 | 类型 | 适用性 | 描述 | 是否必须 |
class | text |
| 关联类 | false |
constrained | bool |
| 是否有外键约束 | false |
cascade | text |
| 指定从父对象到关联对象有哪些级联操作 可选项: all none save-update delete | false |
outer-join | bool |
| 如果设置了hibernate.use_outer_join,则使这个关联的outer-join fetching有效 可选项: true false auto | false |
个性化字段映射
参数 | 类型 | 适用性 | 描述 | 是否必须 |
name | text |
| 字段名 | true |
length | text |
| 字段长度 | false |
unique | bool |
| 字段是否unique | false |
not-null | bool |
| 字段是否nullable | false |
index | text |
| Index名称 | false |
unique-key | text |
| Unique约束的名称 | false |
sql-type | text |
| SQL字段类型 | false |
Defines a set
参数 | 类型 | 适用性 | 描述 | 是否必须 |
inverse | bool |
| 是否转置的collection | false |
table | text |
| 角色名称的默认值: Collection表的名称 (不是用于one-to-many关联) | false |
schema | text |
| 用于覆盖已声明schema的表schema名称 | false |
lazy | bool |
| 使lazy 初始化有效 | false |
cascade | text |
| 指定从父对象到关联对象有哪些级联操作 可选项: all none save-update delete | false |
sort | text |
| 指定一个排序的collection,该collection应该具有自然的排序顺序或者一个给定的comparator class | false |
order-by | text |
| 指定定义枚举顺序的表字段 | false |
where | text |
| 一个SQL WHERE 条件 | false |
Defines a bag
参数 | 类型 | 适用性 | 描述 | 是否必须 |
inverse | bool |
| 是否转置的collection | false |
table | text |
| Collection表的名称 (不是用于one-to-many关联) | false |
schema | text |
| 用于覆盖已声明schema的表schema名称 | false |
lazy | bool |
| 使lazy 初始化有效 | false |
cascade | text |
| 指定从父对象到关联对象有哪些级联操作 可选项: all none save-update delete | false |
order-by | text |
| 指定定义枚举顺序的表字段 | false |
where | text |
| 一个SQL WHERE 条件 | false |
Defines a List
参数 | 类型 | 适用性 | 描述 | 是否必须 |
table | text |
| Collection表的名称 (不是用于one-to-many关联) | false |
schema | text |
| 用于覆盖已声明schema的表schema名称 | false |
lazy | bool |
| 使lazy 初始化有效 | false |
cascade | text |
| 指定从父对象到关联对象有哪些级联操作 可选项: all none save-update delete | false |
where | text |
| 一个SQL WHERE 条件 | false |
Defines a map
参数 | 类型 | 适用性 | 描述 | 是否必须 |
table | text |
| Collection表的名称 (不是用于one-to-many关联) | false |
schema | text |
| 用于覆盖已声明schema的表schema名称 | false |
lazy | bool |
| 使lazy 初始化有效 | false |
cascade | text |
| 指定从父对象到关联对象有哪些级联操作 可选项: all save-update delete none | false |
sort | text |
| 指定一个排序的collection,该collection应该具有自然的排序顺序或者一个给定的comparator class | false |
order-by | text |
| 声明定义枚举顺序的表的字段 | false |
where | text |
| 一个SQL WHERE条件 | false |
Defines an array
参数 | 类型 | 适用性 | 描述 | 是否必须 |
table | text |
| Collection表的名称 (不是用于one-to-many关联) | false |
schema | text |
| 为了覆盖已声明schema的表schema的名称 | false |
cascade | text |
| 指定从父对象到关联对象有哪些级联操作 可选项: all none save-update delete | false |
where | text |
| 一个SQL WHERE条件 | false |
@hibernate.primitive-array (0..1)
声明一个primitive-array
参数 | 类型 | 适用性 | 描述 | 是否必须 |
table | text |
| Collection表的名称 (不是用于one-to-many关联) | false |
schema | text |
| The name of a table schema to override the schema declared | false |
cascade | text |
| 指定从父对象到关联对象有哪些级联操作 可选项: all none save-update delete | false |
where | text |
| 一个SQL WHERE 条件 | false |
@hibernate.collection-key (0..1)
声明一个collection key
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | true |
@hibernate.collection-index (0..1)
声明一个collection index. 用于索引数组, 为映射中的lists或者keys排序
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | true |
类型 | text |
| The Hibernate 类型 | false |
length | text |
| 所应设数据库表字段的长度 | false |
@hibernate.index-many-to-many (0..1)
声明一个many-to-many collection index.将在三重关联中用作映射key. 应该作为entity吗?
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | true |
class | text |
| 在三重关联映射中被用作key的实体 | true |
@hibernate.collection-element (0..1)
声明一个collection 元素
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | true |
type | text |
| The Hibernate 类型 | true |
length | text |
| 所应设数据库表字段的长度 | false |
not-null | bool |
| 字段是否nullable | false |
unique | bool |
| 字段是否unique | false |
@hibernate.collection-composite-element (0..1)
声明一个组合collection元素
参数 | 类型 | 适用性 | 描述 | 是否必须 |
class | text |
| 元素类名称 | true |
@hibernate.collection-many-to-many (0..1)
声明一个many-to-many关系
参数 | 类型 | 适用性 | 描述 | 是否必须 |
column | text |
| 映射的目标数据表字段 | true |
class | text |
| 类全名 | false |
outer-join | text |
| 使outer-join fetching有效 可选项: true false auto | false |
@hibernate.collection-one-to-many (0..1)
Declares a one-to-many relationship
参数 | 类型 | 适用性 | 描述 | 是否必须 |
class | text |
| 关联类的全名 | false |
@hibernate.collection-cache (0..1)
Enables caching
参数 | 类型 | 适用性 | 描述 | 是否必须 |
usage | text |
| 定义缓冲语义 可选项: read-write nonstrict-read-write read-only | true |
@hibernate.collection-jcs-cache (0..1)
是缓冲有效 (不建议使用)
参数 | 类型 | 适用性 | 描述 | 是否必须 |
usage | text |
| 定义缓冲语义 可选项: read-write nonstrict-read-write read-only |
|