Hibernate Tag 参考手册(中文翻译版1.0)

@hibernate Tag参考

用来声明Hibernate描述文件的Tags

Class层次Tags

@hibernate.class

@hibernate.subclass

@hibernate.discriminator

@hibernate.joined-subclass

@hibernate.joined-subclass-key

@hibernate.cache

@hibernate.jcs-cache

@hibernate.query

 

 

方法层次Tags

@hibernate.id

@hibernate.generator-param

@hibernate.property

@hibernate.component

@hibernate.version

@hibernate.timestamp

@hibernate.many-to-one

@hibernate.one-to-one

@hibernate.column

@hibernate.set

@hibernate.bag

@hibernate.list

@hibernate.map

@hibernate.array

@hibernate.primitive-array

@hibernate.collection-key

@hibernate.collection-index

@hibernate.index-many-to-many

@hibernate.collection-element

@hibernate.collection-composite-element

@hibernate.collection-many-to-many

@hibernate.collection-one-to-many

@hibernate.collection-cache

@hibernate.collection-jcs-cache

 

 

字段层次Tags

Tag用法, Class层次(@hibernate)

@hibernate.class (0..1)

声明一个持久类

参数

类型

适用性

描述

是否必须

table

text

 

 

数据表名

false

discriminator-value

text

 

 

一个用于区分特殊子类的值

false

mutable

bool

 

 

指定该类的实例是否mutabletrue/false

false

dynamic-update

bool

 

 

指定只有改变了的字段出现在SQL UPDATE

false

dynamic-insert

bool

 

 

指定null字段不应出现在SQL INSERT

false

polymorphism

text

 

 

使"explicit"多态性有效

可选项:

explicit

implicit

false

schema

text

 

 

覆盖schemahibernate-mapping根元素中指定的名称

false

proxy

text

 

 

为使用CGLIB proxies指定一个接口

false

@hibernate.subclass (0..1)

声明当前类为子类

参数

类型

适用性

描述

是否必须

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

 

 

覆盖schemahibernate-mapping根元素中指定的名称

false

@hibernate.joined-subclass-key (0..1)

Declares a joined-subclass key

参数

类型

适用性

描述

是否必须

column

text

 

 

映射的目标数据表字段

true

@hibernate.cache (0..1)

Enables caching

参数

类型

适用性

描述

是否必须

usage

text

 

 

定义缓冲语义

可选项:

read-write

nonstrict-read-write

read-only

true

@hibernate.jcs-cache (0..1)

Enables caching (deprecated)

参数

类型

适用性

描述

是否必须

usage

text

 

 

定义缓冲语义.

nonstrict-read-write只应用于版本2.0或者更新的版本.

可选项:

read-write

nonstrict-read-write

read-only

true

@hibernate.query (0..*)

为类声明一个有名称的查询

参数

类型

适用性

描述

是否必须

name

text

 

 

查询的名称

true

query

text

 

 

查询的内容

true

Tag Usage, Method Level (@hibernate)

@hibernate.id (0..1)

定义一个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

@hibernate.property (0..1)

定义一个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

@hibernate.component (0..1)

声明一个component

参数

类型

适用性

描述

是否必须

class

text

 

 

特定类的全名

false

@hibernate.version (0..1)

Declares a version property

参数

类型

适用性

描述

是否必须

column

text

 

 

存放版本号的字段名称

false

Type

text

 

 

Hibernate 类型

可选项:

integer

short

long

timestamp

calendar

false

@hibernate.timestamp (0..1)

Declares a timestamp property

参数

类型

适用性

描述

是否必须

column

text

 

 

存放timestamp的字段名称

false

@hibernate.many-to-one (0..1)

声明一个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

@hibernate.one-to-one (0..1)

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

@hibernate.column (0..*)

个性化字段映射

参数

类型

适用性

描述

是否必须

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

@hibernate.set (0..1)

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

@hibernate.bag (0..1)

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

@hibernate.list (0..1)

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

@hibernate.map (0..1)

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

@hibernate.array (0..1)

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

 

 

 

 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值