Package org.hibernate.annotations
Annotation Type Table
-
@Target(TYPE) @Retention(RUNTIME) @Repeatable(Tables.class) public @interface Table
Complementary information for a table declared using theTable
, orSecondaryTable
annotation. Usually used only for secondary tables.- See Also:
Table
,SecondaryTable
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description String
checkConstraint
A check constraint, written in native SQL.String
comment
Specifies comment to add to the generated DDL for the table.FetchMode
fetch
Defines a fetching strategy for the secondary table.ForeignKey
foreignKey
Deprecated.useSecondaryTable.foreignKey()
Index[]
indexes
Deprecated.useTable.indexes()
orSecondaryTable.indexes()
boolean
inverse
If enabled, Hibernate will never insert or update the columns of the secondary table.boolean
optional
If enabled, Hibernate will insert a row only if the columns of the secondary table would not all be null, and will always use an outer join to read the columns.SQLDelete
sqlDelete
Defines a custom SQL delete statement.SQLInsert
sqlInsert
Defines a custom SQL insert statement.SQLUpdate
sqlUpdate
Defines a custom SQL update statement.
-
-
-
Element Detail
-
appliesTo
String appliesTo
The name of the targeted table.
-
-
-
indexes
@Deprecated(since="6.0") Index[] indexes
Deprecated.useTable.indexes()
orSecondaryTable.indexes()
Indexes.- Default:
- {}
-
-
-
foreignKey
@Deprecated(since="6.0") ForeignKey foreignKey
Deprecated.useSecondaryTable.foreignKey()
Specifies a foreign key of a secondary table, which points back to the primary table.- Default:
- @org.hibernate.annotations.ForeignKey(name="")
-
-
-
fetch
FetchMode fetch
Defines a fetching strategy for the secondary table.- If set to
FetchMode.JOIN
, the default, Hibernate will use an inner join to retrieve a secondary table defined by a class or its superclasses and an outer join for a secondary table defined by a subclass. - If set to
FetchMode.SELECT
then Hibernate will use a sequential select for a secondary table defined on a subclass, which will be issued only if a row turns out to represent an instance of the subclass. Inner joins will still be used to retrieve a secondary table defined by the class and its superclasses.
Only applies to secondary tables.
- Default:
- org.hibernate.annotations.FetchMode.JOIN
- If set to
-
-
-
optional
boolean optional
If enabled, Hibernate will insert a row only if the columns of the secondary table would not all be null, and will always use an outer join to read the columns. Thus, by default, Hibernate avoids creating a row of null values.Only applies to secondary tables.
- Default:
- true
-
-