- 12
- 0
- 约1.31万字
- 约 20页
- 2017-07-05 发布于河南
- 举报
Hibernate各种主键生成策略与配置详解(国外英文资料)
Hibernate各种主键生成策略与配置详解
Hibernate various primary key generation strategies and configuration detail
Catalog
Hibernate various key generation strategies and configuration details 1
1, assigned 2
2, increment 2
3, Hilo 2
4, seqhilo 3
5, sequence 3
6, identity 3
7, native 3
8, UUID 3
9, guid 3
10, foreign 3
11, select 3
12, other notes, configuration 3
13 summary 3
1, assigned
The primary key is generated by an external program and must be specified before save (). Hibernate is not responsible for maintaining primary key generation. Unrelated to Hibernate and the underlying database, you can cross databases. Before storing objects, you must assign the primary key to the primary key using the setter method, and how this value is generated is entirely up to you, and this approach should be avoided as much as possible.
id name=, Id, column=, Id
generator class= assigned /
/id
Comment mode
@Id
@GeneratedValue (generator = ` UD )
@GenericGenerator (name = ` UD , strategy = ` assigned)
UD is a custom policy name, a human name, followed by UD.
Features: cross database, artificial control, primary key generation, should be avoided as far as possible.
2, increment
The maximum value is Hibernate out of the database of the key (each session only take 1 times), on the basis of the value of each, in increments of 1, generating primary key in memory, do not depend on the underlying database, so we can cross database.
id name=, Id, column=, Id
generator class= increment /
/id
Hibernate calls the generate () method inside the org.hibernate.id.IncrementGenerator class and uses the select max (idColumnName) from tableName statement to obtain the primary key maximum. The method is declared as synchronized, however, so in a Java virtual machine internal independence is not a problem, and access to the database select max on multiple concurrent JVM could remove the same value, then insert will happen Dumplicate entry error. So there is only one Hibernate application process to access t
您可能关注的文档
- 08年5月2级(国外英文资料).doc
- 08年中考试题(国外英文资料).doc
- 08高考物理命题热点解读(国外英文资料).doc
- 07年5月(3级)(国外英文资料).doc
- 09年11月三级国家心理考试试题(国外英文资料).doc
- 09年二级建造师水利水电管理与实务练习题汇总(国外英文资料).doc
- 09年环境心理学试卷(国外英文资料).doc
- 09年十大感动中国人物。(国外英文资料).doc
- 09感动中国(国外英文资料).doc
- 1 更适宜病人的物理环境(国外英文资料).doc
- 2026中国一汽研发总院全球校园招聘备考题库(含答案详解).docx
- 2026年茶叶种植及加工行业品牌化客户关系管理策略.docx
- 2025年儿童安全座椅材料创新与性能提升行业报告.docx
- 西班牙旅游业复苏策略:2025年旅游科技与体验升级行业报告.docx
- 2026年生物天然气行业竞争格局与投资策略研究报告.docx
- 2026年数字经济在线影视行业内容创作内容创作生态优化报告.docx
- 2025年智能交通光学传感器技术分析报告.docx
- 2026中国一汽研发总院全球校园招聘备考题库带答案详解.docx
- 2026中国一汽研发总院全球校园招聘备考题库有完整答案详解.docx
- 2026年环境传感器行业技术成熟度与商业化进程报告.docx
原创力文档

文档评论(0)