Files
hibernate-demo/id-generation/output/05-auto-and-uuid-per-dialect.txt

50 lines
3.6 KiB
Plaintext

What @GeneratedValue (AUTO) and UUID ids become per dialect. DDL only: no database connection is opened for the dialects other than H2. Hibernate 7.4.14.Final
== H2 (org.hibernate.dialect.H2Dialect)
create sequence AutoLongItem_SEQ start with 1 increment by 50;
create table AutoLongItem (id bigint not null, name varchar(255), primary key (id));
create table AutoUuidItem (id uuid not null, name varchar(255), primary key (id));
create table IdentityItem (id bigint generated by default as identity, name varchar(255), primary key (id));
create table UuidCharItem (id char(36) not null, name varchar(255), primary key (id));
create table UuidV7Item (id uuid not null, name varchar(255), primary key (id));
== PostgreSQL (org.hibernate.dialect.PostgreSQLDialect)
create sequence AutoLongItem_SEQ start with 1 increment by 50;
create table AutoLongItem (id bigint not null, name varchar(255), primary key (id));
create table AutoUuidItem (id uuid not null, name varchar(255), primary key (id));
create table IdentityItem (id bigint generated by default as identity, name varchar(255), primary key (id));
create table UuidCharItem (id char(36) not null, name varchar(255), primary key (id));
create table UuidV7Item (id uuid not null, name varchar(255), primary key (id));
== MySQL (org.hibernate.dialect.MySQLDialect)
create table AutoLongItem (id bigint not null, name varchar(255), primary key (id)) engine=InnoDB;
create table AutoLongItem_SEQ (next_val bigint) engine=InnoDB;
create table AutoUuidItem (id binary(16) not null, name varchar(255), primary key (id)) engine=InnoDB;
create table IdentityItem (id bigint not null auto_increment, name varchar(255), primary key (id)) engine=InnoDB;
create table UuidCharItem (id varchar(36) not null, name varchar(255), primary key (id)) engine=InnoDB;
create table UuidV7Item (id binary(16) not null, name varchar(255), primary key (id)) engine=InnoDB;
== MariaDB (org.hibernate.dialect.MariaDBDialect)
create sequence AutoLongItem_SEQ start with 1 increment by 50 nocache;
create table AutoLongItem (id bigint not null, name varchar(255), primary key (id)) engine=InnoDB;
create table AutoUuidItem (id binary(16) not null, name varchar(255), primary key (id)) engine=InnoDB;
create table IdentityItem (id bigint not null auto_increment, name varchar(255), primary key (id)) engine=InnoDB;
create table UuidCharItem (id varchar(36) not null, name varchar(255), primary key (id)) engine=InnoDB;
create table UuidV7Item (id binary(16) not null, name varchar(255), primary key (id)) engine=InnoDB;
== Oracle (org.hibernate.dialect.OracleDialect)
create sequence AutoLongItem_SEQ start with 1 increment by 50;
create table AutoLongItem (id number(19,0) not null, name varchar2(255 char), primary key (id));
create table AutoUuidItem (id raw(16) not null, name varchar2(255 char), primary key (id));
create table IdentityItem (id number(19,0) generated by default as identity, name varchar2(255 char), primary key (id));
create table UuidCharItem (id char(36) not null, name varchar2(255 char), primary key (id));
create table UuidV7Item (id raw(16) not null, name varchar2(255 char), primary key (id));
== SQL Server (org.hibernate.dialect.SQLServerDialect)
create sequence AutoLongItem_SEQ start with 1 increment by 50;
create table AutoLongItem (id bigint not null, name varchar(255), primary key (id));
create table AutoUuidItem (id uniqueidentifier not null, name varchar(255), primary key (id));
create table IdentityItem (id bigint identity not null, name varchar(255), primary key (id));
create table UuidCharItem (id char(36) not null, name varchar(255), primary key (id));
create table UuidV7Item (id uniqueidentifier not null, name varchar(255), primary key (id));