Home > Database > Mysql Tutorial > Hibernate主键自动生成的几种常用类型

Hibernate主键自动生成的几种常用类型

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:09:06
Original
1004 people have browsed it

1.Assigned 主键由数据库内部生成,无需Hibernate干预。2.hilo 需要额外数据库表保存主键生成历史状态。

1.Assigned 主键由数据库内部生成,无需Hibernate干预。

2.hilo 需要额外数据库表保存主键生成历史状态。

3.increment 在实例中维持一个变量,以保存当前最大值。多实例访问时可能会出错。

4.identity 采用数据库提供的生成机制,,如SQL Server、MySQL中自增主键生成机制。

5.sequence 采用数据库提供的sequence生成机制,如果Oracle。

6.uuid.hex 由hibernate基于128位唯一值算法生成,最大的保证唯一性,可能数万年才出现一次重复。

7.native 由hibernate自动判断数据库类型而采用不同的生成机制,常用。

linux

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template