注释接口 JoinTable


@Retention(RUNTIME) @Target(allowedTargets=PROPERTY) @Target(METHOD) public @interface JoinTable
This annotation should typically be used with ManyToMany, but it can also be used with ManyToOne or OneToOne.

The annotation cannot be used by the reversed(with `mappedBy`) property

The middle table should only have two columns:

  • one pointing to the foreign key of the entity in which the current property resides
  • and the other pointing to the foreign key of the entity returned by the current property
The two foreign keys are combined to serve as the primary key.
  • For many-to-many associations, if you want to add more business fields to the middle table, this annotation is no longer applicable, please use ManyToManyView
  • For many-to-one associations, unique constraint should be added to the foreign key pointing to the entity in which the current property resides.
  • For one-to-one associations, unique constraint should be added to each foreign key.
  • 元素详细资料

    • name

      String name
      Middle table name.

      If it is not specified, it will be determined by Jimmer. For example, If the current entity is `Book` and the target entity is `Author`, the default middle table name is `BOOK_AUTHOR_MAPPING`

      默认值:
      ""
    • joinColumnName

      String joinColumnName
      The column name of the foreign key of the entity in which the current property resides

      This argument cannot be specified together with joinColumns()

      It is better than joinColumns() when foreign key is real database constraint and has only one column
      默认值:
      ""
    • inverseJoinColumnName

      String inverseJoinColumnName
      The column names of the foreign key of the entity returned by the current property

      This argument cannot be specified together with inverseColumns()

      It is better than inverseColumns() when foreign key is real database constraint and has only one column
      默认值:
      ""
    • joinColumns

      JoinColumn[] joinColumns
      The column name of the foreign key of the entity in which the current property resides

      This argument cannot be specified together with joinColumnName()

      This argument must be configured when foreign key * is not real database constraint or has only more than 1 columns
      默认值:
      {}
    • inverseColumns

      JoinColumn[] inverseColumns
      The column names of the foreign key of the entity returned by the current property

      This argument cannot be specified together with inverseJoinColumnName()

      This argument must be configured when foreign key is not real database constraint or has only more than 1 columns
      默认值:
      {}
    • preventDeletionBySource

      boolean preventDeletionBySource
      默认值:
      false
    • preventDeletionByTarget

      boolean preventDeletionByTarget
      默认值:
      false