注释接口 JoinColumn
@Retention(RUNTIME)
@Target(allowedTargets=PROPERTY)
@Target(METHOD)
@Repeatable(JoinColumns.class)
public @interface JoinColumn
Optional annotation to specify the column name for foreign key properties,
that means many-to-one or one-to-one property which is neither reversed
(with `mappedBy`) nor based on middle table.
If the column name inferred according to the Java/Kotlin property name based on Rule `word1Word2...WordN -> WORD1_WORD2_..._WORDN_ID` is different from the column name in the database, or the foreign key is fake(Not a real foreign key constraint in the database, but a concept only in the minds of developers), this annotation must be used.
Note: This annotation can only be used to map foreign key.
For scalar column, Column is useful
-
必需元素概要
所需元素 -
可选元素概要
可选元素修饰符和类型可选元素说明If ture(default), the foreign key is real, that means it a real foreign key constraint in the database Otherwise, the foreign key is fake, which is not a real foreign key constraint in database but a concept only in the minds of developersA column name of the primary key of the parent table referenced by the foreign key
-
元素详细资料
-
name
String nameA column name of foreign key -
referencedColumnName
String referencedColumnNameA column name of the primary key of the parent table referenced by the foreign keyIf the foreign key has only one column, it is unnecessary to specify it
- 默认值:
""
-
foreignKeyType
ForeignKeyType foreignKeyType- If ture(default), the foreign key is real, that means it a real foreign key constraint in the database
- Otherwise, the foreign key is fake, which is not a real foreign key constraint in database but a concept only in the minds of developers
- 默认值:
AUTO
-