From 816333614253679849b4d5ec1b65325fd169140d Mon Sep 17 00:00:00 2001 From: Gavin King Date: Tue, 22 Aug 2023 15:53:20 +0200 Subject: [PATCH] add options member to elements which result in DDL generation see #353 --- .../jakarta/persistence/CheckConstraint.java | 10 +- .../jakarta/persistence/CollectionTable.java | 9 + .../main/java/jakarta/persistence/Column.java | 9 + .../persistence/DiscriminatorColumn.java | 9 + .../java/jakarta/persistence/ForeignKey.java | 45 +++-- .../main/java/jakarta/persistence/Index.java | 12 +- .../java/jakarta/persistence/JoinColumn.java | 9 + .../java/jakarta/persistence/JoinTable.java | 9 + .../jakarta/persistence/MapKeyColumn.java | 169 ++++++++-------- .../jakarta/persistence/MapKeyJoinColumn.java | 191 +++++++++--------- .../java/jakarta/persistence/OrderColumn.java | 53 +++-- .../persistence/PrimaryKeyJoinColumn.java | 9 + .../jakarta/persistence/SecondaryTable.java | 9 + .../persistence/SequenceGenerator.java | 8 + .../main/java/jakarta/persistence/Table.java | 15 +- .../jakarta/persistence/TableGenerator.java | 8 + .../jakarta/persistence/UniqueConstraint.java | 18 +- .../ch11-metadata-for-or-mapping.adoc | 96 +++++++++ 18 files changed, 468 insertions(+), 220 deletions(-) diff --git a/api/src/main/java/jakarta/persistence/CheckConstraint.java b/api/src/main/java/jakarta/persistence/CheckConstraint.java index b2e311dd..d91ec92c 100644 --- a/api/src/main/java/jakarta/persistence/CheckConstraint.java +++ b/api/src/main/java/jakarta/persistence/CheckConstraint.java @@ -34,7 +34,8 @@ public @interface CheckConstraint { /** - * (Optional) The name of the constraint; defaults to a provider-generated name. + * (Optional) The name of the constraint. + *

Defaults to a provider-generated name. */ String name() default ""; @@ -43,4 +44,11 @@ */ String constraint(); + /** + * (Optional) A SQL fragment appended to the generated DDL + * which creates this constraint. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/CollectionTable.java b/api/src/main/java/jakarta/persistence/CollectionTable.java index 763cad04..26535c1c 100644 --- a/api/src/main/java/jakarta/persistence/CollectionTable.java +++ b/api/src/main/java/jakarta/persistence/CollectionTable.java @@ -168,4 +168,13 @@ * @since 2.1 */ Index[] indexes() default {}; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * statement which creates this table. This is only used if + * table generation is in effect. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/Column.java b/api/src/main/java/jakarta/persistence/Column.java index 2b3cbc14..e48dc63f 100644 --- a/api/src/main/java/jakarta/persistence/Column.java +++ b/api/src/main/java/jakarta/persistence/Column.java @@ -96,6 +96,15 @@ */ String columnDefinition() default ""; + /** + * (Optional) A SQL fragment appended to the generated DDL + * which declares this column. May not be used in + * conjunction with {@link #columnDefinition()}. + * + * @since 3.2 + */ + String options() default ""; + /** * (Optional) The name of the table that contains the column. * If absent the column is assumed to be in the primary table. diff --git a/api/src/main/java/jakarta/persistence/DiscriminatorColumn.java b/api/src/main/java/jakarta/persistence/DiscriminatorColumn.java index ce1bedd2..3d336c47 100644 --- a/api/src/main/java/jakarta/persistence/DiscriminatorColumn.java +++ b/api/src/main/java/jakarta/persistence/DiscriminatorColumn.java @@ -77,6 +77,15 @@ */ String columnDefinition() default ""; + /** + * (Optional) A SQL fragment appended to the generated DDL + * which declares this column. May not be used in + * conjunction with {@link #columnDefinition()}. + * + * @since 3.2 + */ + String options() default ""; + /** * (Optional) The column length for String-based discriminator types. * Ignored for other discriminator types. diff --git a/api/src/main/java/jakarta/persistence/ForeignKey.java b/api/src/main/java/jakarta/persistence/ForeignKey.java index 04d5c4f8..87bc0e51 100644 --- a/api/src/main/java/jakarta/persistence/ForeignKey.java +++ b/api/src/main/java/jakarta/persistence/ForeignKey.java @@ -63,28 +63,28 @@ public @interface ForeignKey { /** - * (Optional) The name of the foreign key constraint. If this - * is not specified, it defaults to a provider-generated name. + * (Optional) The name of the foreign key constraint. + *

Defaults to a provider-generated name. */ String name() default ""; /** - * (Optional) Used to specify whether a foreign key constraint should be - * generated when schema generation is in effect. - *

- * A value of CONSTRAINT will cause the persistence - * provider to generate a foreign key constraint. If the - * foreignKeyDefinition element is not specified, the - * provider will generate a constraint whose update - * and delete actions it determines most appropriate for the - * join column(s) to which the foreign key annotation is applied. - *

- * A value of NO_CONSTRAINT will result in no - * constraint being generated. - *

- * A value of PROVIDER_DEFAULT will result in the - * provider's default behavior (which may or may not result - * in the generation of a constraint for the given join column(s). + * (Optional) Used to specify whether a foreign key constraint + * should be generated when schema generation is in effect. + *

*/ ConstraintMode value() default CONSTRAINT; @@ -92,4 +92,13 @@ * (Optional) The foreign key constraint definition. */ String foreignKeyDefinition() default ""; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * which creates this foreign key. May not be used in + * conjunction with {@link #foreignKeyDefinition()}. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/Index.java b/api/src/main/java/jakarta/persistence/Index.java index 784a7634..fae8ee0d 100644 --- a/api/src/main/java/jakarta/persistence/Index.java +++ b/api/src/main/java/jakarta/persistence/Index.java @@ -51,12 +51,13 @@ public @interface Index { /** - * (Optional) The name of the index; defaults to a provider-generated name. + * (Optional) The name of the index. + *

Defaults to a provider-generated name. */ String name() default ""; /** - * (Required) The names of the columns to be included in the index, + * (Required) The names of the columns included in the index, * in order. */ String columnList(); @@ -66,4 +67,11 @@ */ boolean unique() default false; + /** + * (Optional) A SQL fragment appended to the generated DDL + * which creates this index. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/JoinColumn.java b/api/src/main/java/jakarta/persistence/JoinColumn.java index 380d92e1..b6b2d2cf 100644 --- a/api/src/main/java/jakarta/persistence/JoinColumn.java +++ b/api/src/main/java/jakarta/persistence/JoinColumn.java @@ -152,6 +152,15 @@ */ String columnDefinition() default ""; + /** + * (Optional) A SQL fragment appended to the generated DDL + * which declares this column. May not be used in + * conjunction with {@link #columnDefinition()}. + * + * @since 3.2 + */ + String options() default ""; + /** * (Optional) The name of the table that contains * the column. If a table is not specified, the column diff --git a/api/src/main/java/jakarta/persistence/JoinTable.java b/api/src/main/java/jakarta/persistence/JoinTable.java index cbaf046e..934f515b 100644 --- a/api/src/main/java/jakarta/persistence/JoinTable.java +++ b/api/src/main/java/jakarta/persistence/JoinTable.java @@ -168,4 +168,13 @@ * @since 3.2 */ String comment() default ""; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * statement which creates this table. This is only used if + * table generation is in effect. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/MapKeyColumn.java b/api/src/main/java/jakarta/persistence/MapKeyColumn.java index a8cd9687..e2b021e6 100644 --- a/api/src/main/java/jakarta/persistence/MapKeyColumn.java +++ b/api/src/main/java/jakarta/persistence/MapKeyColumn.java @@ -50,85 +50,92 @@ @Retention(RUNTIME) public @interface MapKeyColumn { - /** - * (Optional) The name of the map key column. The table in which it is found - * depends upon the context. If the map key is for an element collection, - * the map key column is in the collection table for the map value. If the - * map key is for a ManyToMany entity relationship or for a OneToMany entity - * relationship using a join table, the map key column is in a join table. - * If the map key is for a OneToMany entity relationship using a foreign key - * mapping strategy, the map key column is in the table of the entity that - * is the value of the map. - *

Defaults to the concatenation of the following: the name of - * the referencing relationship field or property; "_"; "KEY". - */ - String name() default ""; - - /** - * (Optional) Whether the column is a unique key. This is a - * shortcut for the UniqueConstraint annotation - * at the table level and is useful for when the unique key - * constraint corresponds to only a single column. This - * constraint applies in addition to any constraint entailed - * by primary key mapping and to constraints specified at the - * table level. - */ - boolean unique() default false; - - /** (Optional) Whether the database column is nullable. */ - boolean nullable() default false; - - /** - * (Optional) Whether the column is included in SQL INSERT statements - * generated by the persistence provider. - */ - boolean insertable() default true; - - /** - * (Optional) Whether the column is included in SQL UPDATE statements - * generated by the persistence provider. - */ - boolean updatable() default true; - - /** - * (Optional) The SQL fragment that is used when generating the DDL for the - * column. - *

Defaults to the generated SQL to create a - * column of the inferred type. - * - */ - String columnDefinition() default ""; - - /** (Optional) The name of the table that contains the column. - * - *

Defaults: If the map key is for an element collection, - * the name of the collection table for the map value. If the - * map key is for a OneToMany or ManyToMany entity - * relationship using a join table, the name of the join table - * for the map. If the map key is for a OneToMany entity - * relationship using a foreign key mapping strategy, the name - * of the primary table of the entity that is the value of the - * map. - */ - String table() default ""; - - /** - * (Optional) The column length. (Applies only if a string-valued column is - * used.) - */ - int length() default 255; - - /** - * (Optional) The precision for a decimal (exact numeric) column. (Applies - * only if a decimal column is used.) - * - *

Default: 0. (The value must be set by the developer.) - */ - int precision() default 0; // decimal precision - - /** - * (Optional) The scale for a decimal (exact numeric) column. (Applies only - * if a decimal column is used.) - */ - int scale() default 0; // decimal scale + /** + * (Optional) The name of the map key column. The table in which it is found + * depends upon the context. If the map key is for an element collection, + * the map key column is in the collection table for the map value. If the + * map key is for a ManyToMany entity relationship or for a OneToMany entity + * relationship using a join table, the map key column is in a join table. + * If the map key is for a OneToMany entity relationship using a foreign key + * mapping strategy, the map key column is in the table of the entity that + * is the value of the map. + *

Defaults to the concatenation of the following: the name of + * the referencing relationship field or property; "_"; "KEY". + */ + String name() default ""; + + /** + * (Optional) Whether the column is a unique key. This is a + * shortcut for the UniqueConstraint annotation + * at the table level and is useful for when the unique key + * constraint corresponds to only a single column. This + * constraint applies in addition to any constraint entailed + * by primary key mapping and to constraints specified at the + * table level. + */ + boolean unique() default false; + + /** (Optional) Whether the database column is nullable. */ + boolean nullable() default false; + + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; + + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; + + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. + *

Defaults to the generated SQL to create a + * column of the inferred type. + */ + String columnDefinition() default ""; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * which declares this column. May not be used in + * conjunction with {@link #columnDefinition()}. + * + * @since 3.2 + */ + String options() default ""; + + /** (Optional) The name of the table that contains the column. + *

Defaults: If the map key is for an element collection, + * the name of the collection table for the map value. If the + * map key is for a OneToMany or ManyToMany entity + * relationship using a join table, the name of the join table + * for the map. If the map key is for a OneToMany entity + * relationship using a foreign key mapping strategy, the name + * of the primary table of the entity that is the value of the + * map. + */ + String table() default ""; + + /** + * (Optional) The column length. (Applies only if a string-valued column is + * used.) + */ + int length() default 255; + + /** + * (Optional) The precision for a decimal (exact numeric) column. (Applies + * only if a decimal column is used.) + * + *

Default: 0. (The value must be set by the developer.) + */ + int precision() default 0; // decimal precision + + /** + * (Optional) The scale for a decimal (exact numeric) column. (Applies only + * if a decimal column is used.) + */ + int scale() default 0; // decimal scale } diff --git a/api/src/main/java/jakarta/persistence/MapKeyJoinColumn.java b/api/src/main/java/jakarta/persistence/MapKeyJoinColumn.java index 5d3977c9..ec5e8190 100644 --- a/api/src/main/java/jakarta/persistence/MapKeyJoinColumn.java +++ b/api/src/main/java/jakarta/persistence/MapKeyJoinColumn.java @@ -95,103 +95,112 @@ @Target( { METHOD, FIELD }) @Retention(RUNTIME) public @interface MapKeyJoinColumn { - /** - * (Optional) The name of the foreign key column for the map - * key. The table in which it is found depends upon the - * context. - *

- * - *

Default (only applies if a single join column is used.) - * The concatenation of the following: the name of the - * referencing relationship property or field of the - * referencing entity or embeddable class; "_"; "KEY". - */ - String name() default ""; + /** + * (Optional) The name of the foreign key column for the map + * key. The table in which it is found depends upon the + * context. + *

+ * + *

Default (only applies if a single join column is used.) + * The concatenation of the following: the name of the + * referencing relationship property or field of the + * referencing entity or embeddable class; "_"; "KEY". + */ + String name() default ""; - /** - * (Optional) The name of the column referenced by this foreign key column. - * The referenced column is in the table of the target entity. - * - *

Default (only applies if single join column is being - * used.) The same name as the primary key column of the - * referenced table - */ - String referencedColumnName() default ""; + /** + * (Optional) The name of the column referenced by this foreign key column. + * The referenced column is in the table of the target entity. + * + *

Default (only applies if single join column is being + * used.) The same name as the primary key column of the + * referenced table + */ + String referencedColumnName() default ""; - /** - * (Optional) Whether the property is a unique key. This is a - * shortcut for the UniqueConstraint annotation - * at the table level and is useful for when the unique key - * constraint is only a single field. - */ - boolean unique() default false; + /** + * (Optional) Whether the property is a unique key. This is a + * shortcut for the UniqueConstraint annotation + * at the table level and is useful for when the unique key + * constraint is only a single field. + */ + boolean unique() default false; - /** - * (Optional) Whether the foreign key column is nullable. - */ - boolean nullable() default false; + /** + * (Optional) Whether the foreign key column is nullable. + */ + boolean nullable() default false; - /** - * (Optional) Whether the column is included in SQL INSERT statements - * generated by the persistence provider. - */ - boolean insertable() default true; + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; - /** - * (Optional) Whether the column is included in SQL UPDATE statements - * generated by the persistence provider. - */ - boolean updatable() default true; + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; - /** - * (Optional) The SQL fragment that is used when generating the DDL for the - * column. + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. * Defaults to SQL generated by the provider for the column. - */ - String columnDefinition() default ""; + */ + String columnDefinition() default ""; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * which declares this column. May not be used in + * conjunction with {@link #columnDefinition()}. + * + * @since 3.2 + */ + String options() default ""; + + /** + * (Optional) The name of the table that contains the foreign key column. + *

+ *

Default: + *

+ */ + String table() default ""; - /** - * (Optional) The name of the table that contains the foreign key column. - * - *

Default: - *

- */ - String table() default ""; - - /** - * (Optional) Used to specify or control the generation of a - * foreign key constraint when table generation is in effect. If - * this element is not specified, the persistence provider's - * default foreign key strategy will apply. - * - * @since 2.1 - */ - ForeignKey foreignKey() default @ForeignKey(ConstraintMode.PROVIDER_DEFAULT); + /** + * (Optional) Used to specify or control the generation of a + * foreign key constraint when table generation is in effect. If + * this element is not specified, the persistence provider's + * default foreign key strategy will apply. + * + * @since 2.1 + */ + ForeignKey foreignKey() default @ForeignKey(ConstraintMode.PROVIDER_DEFAULT); } diff --git a/api/src/main/java/jakarta/persistence/OrderColumn.java b/api/src/main/java/jakarta/persistence/OrderColumn.java index d71a4ea9..8f1c6f4f 100644 --- a/api/src/main/java/jakarta/persistence/OrderColumn.java +++ b/api/src/main/java/jakarta/persistence/OrderColumn.java @@ -72,30 +72,39 @@ @Retention(RUNTIME) public @interface OrderColumn { - /** (Optional) The name of the ordering column. - * Defaults to the concatenation of the name of the - * referencing property or field; "_"; "ORDER". - */ - String name() default ""; + /** (Optional) The name of the ordering column. + * Defaults to the concatenation of the name of the + * referencing property or field; "_"; "ORDER". + */ + String name() default ""; - /** (Optional) Whether the database column is nullable. */ - boolean nullable() default true; + /** (Optional) Whether the database column is nullable. */ + boolean nullable() default true; - /** - * (Optional) Whether the column is included in SQL INSERT statements - * generated by the persistence provider. - */ - boolean insertable() default true; + /** + * (Optional) Whether the column is included in SQL INSERT statements + * generated by the persistence provider. + */ + boolean insertable() default true; - /** - * (Optional) Whether the column is included in SQL UPDATE statements - * generated by the persistence provider. - */ - boolean updatable() default true; + /** + * (Optional) Whether the column is included in SQL UPDATE statements + * generated by the persistence provider. + */ + boolean updatable() default true; - /** - * (Optional) The SQL fragment that is used when generating the DDL for the - * column. Defaults to generated SQL to create a column of the inferred type. - */ - String columnDefinition() default ""; + /** + * (Optional) The SQL fragment that is used when generating the DDL for the + * column. Defaults to generated SQL to create a column of the inferred type. + */ + String columnDefinition() default ""; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * which declares this column. May not be used in + * conjunction with {@link #columnDefinition()}. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/PrimaryKeyJoinColumn.java b/api/src/main/java/jakarta/persistence/PrimaryKeyJoinColumn.java index e196128e..c32f8e20 100644 --- a/api/src/main/java/jakarta/persistence/PrimaryKeyJoinColumn.java +++ b/api/src/main/java/jakarta/persistence/PrimaryKeyJoinColumn.java @@ -106,6 +106,15 @@ */ String columnDefinition() default ""; + /** + * (Optional) A SQL fragment appended to the generated DDL + * which declares this column. May not be used in + * conjunction with {@link #columnDefinition()}. + * + * @since 3.2 + */ + String options() default ""; + /** * (Optional) Used to specify or control the generation of a * foreign key constraint for the primary key join column diff --git a/api/src/main/java/jakarta/persistence/SecondaryTable.java b/api/src/main/java/jakarta/persistence/SecondaryTable.java index c6523960..27dd5760 100644 --- a/api/src/main/java/jakarta/persistence/SecondaryTable.java +++ b/api/src/main/java/jakarta/persistence/SecondaryTable.java @@ -134,4 +134,13 @@ * @since 3.2 */ String comment() default ""; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * statement which creates this table. This is only used if + * table generation is in effect. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/SequenceGenerator.java b/api/src/main/java/jakarta/persistence/SequenceGenerator.java index a0ff6327..c1f9bec9 100644 --- a/api/src/main/java/jakarta/persistence/SequenceGenerator.java +++ b/api/src/main/java/jakarta/persistence/SequenceGenerator.java @@ -91,4 +91,12 @@ * sequence numbers from the sequence. */ int allocationSize() default 50; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * statement which creates this sequence. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/Table.java b/api/src/main/java/jakarta/persistence/Table.java index b0f10583..1bea736c 100644 --- a/api/src/main/java/jakarta/persistence/Table.java +++ b/api/src/main/java/jakarta/persistence/Table.java @@ -49,12 +49,14 @@ */ String name() default ""; - /** (Optional) The catalog of the table. + /** + * (Optional) The catalog of the table. *

Defaults to the default catalog. */ String catalog() default ""; - /** (Optional) The schema of the table. + /** + * (Optional) The schema of the table. *

Defaults to the default schema for user. */ String schema() default ""; @@ -94,4 +96,13 @@ * @since 3.2 */ String comment() default ""; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * statement which creates this table. This is only used if + * table generation is in effect. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/TableGenerator.java b/api/src/main/java/jakarta/persistence/TableGenerator.java index a072c3ed..2f6d8a9d 100644 --- a/api/src/main/java/jakarta/persistence/TableGenerator.java +++ b/api/src/main/java/jakarta/persistence/TableGenerator.java @@ -157,4 +157,12 @@ * @since 2.1 */ Index[] indexes() default {}; + + /** + * (Optional) A SQL fragment appended to the generated DDL + * statement which creates this table. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/api/src/main/java/jakarta/persistence/UniqueConstraint.java b/api/src/main/java/jakarta/persistence/UniqueConstraint.java index 86ef4576..b87d5776 100644 --- a/api/src/main/java/jakarta/persistence/UniqueConstraint.java +++ b/api/src/main/java/jakarta/persistence/UniqueConstraint.java @@ -41,13 +41,25 @@ @Retention(RUNTIME) public @interface UniqueConstraint { - /** (Optional) Constraint name. A provider-chosen name will be chosen - * if a name is not specified. + /** + * (Optional) The name of the constraint. + *

Defaults to a provider-generated name. * * @since 2.0 */ String name() default ""; - /** (Required) An array of the column names that make up the constraint. */ + /** + * (Required) The names of the column which make up the + * constraint. + */ String[] columnNames(); + + /** + * (Optional) A SQL fragment appended to the generated DDL + * which creates this constraint. + * + * @since 3.2 + */ + String options() default ""; } diff --git a/spec/src/main/asciidoc/ch11-metadata-for-or-mapping.adoc b/spec/src/main/asciidoc/ch11-metadata-for-or-mapping.adoc index 1fe23d3f..7d46f3dd 100644 --- a/spec/src/main/asciidoc/ch11-metadata-for-or-mapping.adoc +++ b/spec/src/main/asciidoc/ch11-metadata-for-or-mapping.adoc @@ -689,6 +689,7 @@ public @interface CollectionTable { ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); UniqueConstraint[] uniqueConstraints() default {}; Index[] indexes() default {}; + String options() default ""; } ---- @@ -788,6 +789,11 @@ effect. |(Optional) Indexes for the table. These are only used if table generation is in effect. |No additional indexes + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example:* @@ -857,6 +863,7 @@ public @interface Column { boolean insertable() default true; boolean updatable() default true; String columnDefinition() default ""; + String options() default ""; String table() default ""; int length() default 255; int precision() default 0; // decimal precision @@ -911,6 +918,11 @@ when generating the DDL for the column. |Generated SQL to create a column of the inferred type. +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. + |String |table |(Optional) The name of the table that @@ -1306,6 +1318,7 @@ public @interface DiscriminatorColumn { String name() default "DTYPE"; DiscriminatorType discriminatorType() default STRING; String columnDefinition() default ""; + String options() default ""; int length() default 31; } ---- @@ -1334,6 +1347,11 @@ when generating the DDL for the discriminator column. |Provider-generated SQL to create a column of the specified discriminator type. +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. + |int |length |(Optional) The column length for @@ -1822,6 +1840,7 @@ public @interface ForeignKey { String name() default ""; ConstraintMode value() default CONSTRAINT; String foreignKeyDefinition() default ""; + String options() default ""; } ---- @@ -1886,6 +1905,11 @@ for the _ForeignKey_ annotation. |(Optional) The foreign key constraint definition. |Provider-default. If the value of the ConstraintMode element is NO_CONSTRAINT, the provider must not generate a foreign key constraint. + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== ==== GeneratedValue Annotation [[a14790]] @@ -2109,6 +2133,7 @@ public @interface Index { String name() default ""; String columnList(); boolean unique() default false; + String options() default ""; } ---- @@ -2148,6 +2173,11 @@ included in the index. |unique |(Optional) Whether the index is unique. |false + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== ==== Inheritance Annotation [[a14891]] @@ -2266,6 +2296,7 @@ public @interface JoinColumn { boolean insertable() default true; boolean updatable() default true; String columnDefinition() default ""; + String options() default ""; String table() default ""; ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); CheckConstraint[] check() default {} @@ -2376,6 +2407,11 @@ only used if table generation is in effect. |(Optional) Comment for the column. This is only used if table generation is in effect. |No comment + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example 1:* @@ -2513,6 +2549,7 @@ public @interface JoinTable { Index[] indexes() default {}; CheckConstraint[] check() default {} String comment() default ""; + String options() default ""; } ---- @@ -2589,6 +2626,11 @@ only used if table generation is in effect. |(Optional) Comment for the table. This is only used if table generation is in effect. |No comment + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example:* @@ -3202,6 +3244,7 @@ public @interface MapKeyColumn { boolean insertable() default true; boolean updatable() default true; String columnDefinition() default ""; + String options() default ""; String table() default ""; int length() default 255; int precision() default 0; // decimal precision @@ -3262,6 +3305,11 @@ SQL UPDATE statements generated by the persistence provider. |(Optional) The SQL fragment that is used when generating the DDL for the column. |Generated SQL to create a column of the inferred type. +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. + |String |table |(Optional) The name of the table that contains the column. @@ -3373,6 +3421,7 @@ public @interface MapKeyJoinColumn { boolean insertable() default true; boolean updatable() default true; String columnDefinition() default ""; + String options() default ""; String table() default ""; ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); } @@ -3473,6 +3522,11 @@ SQL UPDATE statements generated by the persistence provider. when generating the DDL for the column. |Generated SQL for the column. +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. + |String |table |(Optional) The name of the table that @@ -4307,6 +4361,7 @@ public @interface OrderColumn { boolean insertable() default true; boolean updatable() default true; String columnDefinition() default ""; + String options() default ""; } ---- @@ -4352,6 +4407,11 @@ SQL UPDATE statements generated by the persistence provider. |columnDefinition |(Optional) The SQL fragment that is used when generating the DDL for the column. |Generated SQL to create a column of the inferred type. + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example 1:* @@ -4454,6 +4514,7 @@ public @interface PrimaryKeyJoinColumn { String name() default ""; String referencedColumnName() default ""; String columnDefinition() default ""; + String options() default ""; ForeignKey foreignKey() default @ForeignKey(PROVIDER_DEFAULT); } ---- @@ -4489,6 +4550,11 @@ when generating the DDL for the column. This should not be specified for a OneToOne primary key association. |Generated SQL to create a column of the inferred type. +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. + |ForeignKey |foreignKey |(Optional) The foreign key constraint @@ -4663,6 +4729,7 @@ public @interface SecondaryTable { Index[] indexes() default {}; CheckConstraint[] check() default {} String comment() default ""; + String options() default ""; } ---- @@ -4723,6 +4790,11 @@ only used if table generation is in effect. |(Optional) Comment for the table. This is only used if table generation is in effect. |No comment + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example 1:* Single secondary table with a single primary key column. @@ -4842,6 +4914,7 @@ public @interface SequenceGenerator { String schema() default ""; int initialValue() default 1; int allocationSize() default 50; + String options() default ""; } ---- @@ -4884,6 +4957,11 @@ object is to start generating. |(Optional) The amount to increment by when allocating sequence numbers from the sequence. |50 + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example:* @@ -4947,6 +5025,7 @@ public @interface Table { Index[] indexes() default {}; CheckConstraint[] check() default {} String comment() default ""; + String options() default ""; } ---- @@ -4997,6 +5076,11 @@ only used if table generation is in effect. |(Optional) Comment for the table. This is only used if table generation is in effect. |No comment + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example:* @@ -5049,6 +5133,7 @@ public @interface TableGenerator { int allocationSize() default 50; UniqueConstraint[] uniqueConstraints() default {}; Index[] indexes() default {}; + String options() default ""; } ---- @@ -5121,6 +5206,11 @@ effect. These constraints apply in addition to primary key constraints. |(Optional) Indexes for the table. These are only used if table generation is in effect. |No additional indexes + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example 1:* @@ -5301,6 +5391,7 @@ may be specified for the _UniqueConstraint_ annotation. public @interface UniqueConstraint { String name() default ""; String[] columnNames(); + String options() default ""; } ---- @@ -5318,6 +5409,11 @@ public @interface UniqueConstraint { |columnNames |(Required) An array of the column names that make up the constraint. | + +|String +|options +|(Optional) A SQL fragment appended to the generated DDL. +|Nothing appended. |=== *Example:*