Annotation Interface Comment


Specifies a comment that will be included in generated DDL.

By default, if on() is not specified:

  • when a field or property is annotated, the comment applies to the mapped column,
  • when a collection is annotated, the comment applies to the collection table, and
  • when an entity class is annotated, the comment applies to the primary table.

But when on() is explicitly specified, the comment applies to the mapped table or column with the specified name.

For example:

 @Entity
 @Table(name = "book")
 @SecondaryTable(name = "edition")
 @Comment("The primary table for Book")
 @Comment(on = "edition",
          value = "The secondary table for Book")
 class Book { ... }
 
API Note:
In principle, it's possible for a column of a secondary table to have the same name as a column of the primary table, or as a column of some other secondary table. Therefore, on() may be ambiguous.
Removal (deprecation):
JPA 3.2 adds a comment attribute to Table
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The text of the comment.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The name of the table or column to add the comment to.
  • Element Details

    • value

      String value
      The text of the comment.
    • on

      String on
      The name of the table or column to add the comment to.
      Default:
      ""