首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

8.主键生成谋略

2012-10-18 
8.主键生成策略* Double click id filed* Select JPA-GenerationValue Tab* Select GeneratedValue - st

8.主键生成策略

* Double click id filed

* Select JPA->GenerationValue Tab

* Select GeneratedValue -> strategy : GenerationType.AUTO

8.主键生成谋略

    Generate SQL Script

Click toolbar 8.主键生成谋略

MySQL script

create table Base (id bigint not null auto_increment, name varchar(255), primary key (id));

?

Oracle script

create table Base (id number(19,0) not null, name varchar2(255 char), primary key (id));

create sequence hibernate_sequence;

?

SQLServer

create table Base (id numeric(19,0) identity not null, name varchar(255) null, primary key id));

    Identity primary key

Indicates that the persistence provider must assign primary keys for the entity using database identity column.

    Create Identity primary key

8.主键生成谋略

* Double click id filed

* Select JPA->GenerationValue Tab

* Select GeneratedValue -> strategy : GenerationType.IDENTITY

8.主键生成谋略

    Generate SQL Script

Click toolbar 8.主键生成谋略

MySQL script

create table Base (id bigint not null auto_increment, name varchar(255), primary key (id));

?

Oracle script

Not supported

?

SQLServer

create table Base (id numeric(19,0) identity not null, name varchar(255) null, primary key(id));

    Sequence primary key

Indicates that the persistence provider should pick an appropriate strategy for the particular database. The AUTO generation strategy may expect a database resource to exist, or it may attempt to create one. A vendor may provide documentation on how to create such resources in the event that it does not support schema generation or cannot create the schema resource at runtime.

    Create Sequence primary key

8.主键生成谋略

* Double click id filed

* Select JPA->GenerationValue Tab

* Select GeneratedValue -> strategy : GenerationType.SEQUENCE

* Please enter the custom generator name

* Please enter the custom sequenceName name

8.主键生成谋略

    Generate SQL Script

Click toolbar 8.主键生成谋略

MySQL script

Not supported

?

Oracle script

create table Base (id number(19,0) not null, name varchar2(255 char), primary key (id));

create sequence mysequence;

?

SQLServer

Not supported

    Table primary key

Indicates that the persistence provider must assign primary keys for the entity using an underlying database table to ensure uniqueness.

    Create Table primary key

8.主键生成谋略

* Double click id filed

* Select JPA->GenerationValue Tab

* Select GeneratedValue -> strategy : GenerationType.TABLE

* Please enter the custom generator name

* Please enter the custom table name

* Please enter the custom pkColumnName or empty

* Please enter the custom valueColumnName or empty

8.主键生成谋略

    Generate SQL Script

Click toolbar 8.主键生成谋略

MySQL script

create table Base (id bigint not null, name varchar(255), primary key (id));

create table mytable ( pkColumn varchar(255), valueColumn integer ) ;

?

Oracle script

create table Base (id number(19,0) not null, name varchar2(255 char), primary key (id));

create table mytable ( pkColumn varchar2(255 char), valueColumn number(10,0) ) ;

?

SQLServer

create table Base (id numeric(19,0) not null, name varchar(255) null, primary key (id));

create table mytable ( pkColumn varchar(255), valueColumn int ) ;

?

?

热点排行