Annotation Interface GeneratedForeignKey


@Retention(CLASS) @Target({}) @Documented public @interface GeneratedForeignKey
Represents an association for which the cardinality of one of the roles is either zero-to-one or one. These associations need not be stored in a separate link table since the "other" role can simply store a reference to the zero/zero-to-one role (much like a link stores references to the A/B roles). Storing the association as a foreign key gives two additional benefits:
  • the zero/zero-to-one role can be accessed in the same way as any other property of the object (part.getMaster() will return the master for the master/iteration association)
  • the zero/zero-to-one role can be autonavigated, saving a database hit when the role is accessed as a property (as in part.getMaster()); enabling autonavigation will cause queries to automatically include the role when returning the persistables that store their references.
The role which stores the reference is referred to in this annotation as myRole(); the aggregated role is foreignKeyRole().

Supported API: true

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The properties of the "aggregated" (one/zero-to-one cardinality) role.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Represents the properties of "this" role as it would be navigated from the foreign key role.
    boolean
    Specifies which role serves as the "A" role for the association.
    The (stored) name of the foreign key link.
    The parent class for this foreign key link class.
  • Element Details

    • name

      String name
      The (stored) name of the foreign key link. Typically left blank, resulting in an association named by concatenating the roleA and roleB names (for example, the master/iteration foreign key association is named MasterIteration by default.

      Rose conversion note: Corresponds to Association Specification -> General -> Name.

      Supported API: true

      Default:
      ""
    • superClassName

      String superClassName
      The parent class for this foreign key link class. This class would normally be the class designated by the extends statement and is needed because the annotated class must extend "_"+classname" (for example public MyClass extends _MyClass).

      Note: the parent must be an abstract/concrete class that extends on of the foreign key link classes, like ForeignKeyLink.

      Note also: this property should rarely be used and exists solely for backwards compatibility.

      Rose conversion note: Corresponds to Class Specification -> Relations -> Specialize Class (where the specialized class is the single (non-interface) parent class).

      Supported API: true

      Default:
      "wt.fc.ForeignKeyLink"
    • myRole

      MyRole myRole
      Represents the properties of "this" role as it would be navigated from the foreign key role. While foreign key links are generally not navigated as associations, this role is the role that would be specified to navigate from the aggregated (foreign key) object to the object(s) that are aggregating it. For the master/iteration foreign key association, this role is the "iteration" side.

      Rose conversion note: Corresponds to Association Specification -> Role A/B General as well as Association Specification -> Windchill A/B.

      Supported API: true

      Default:
      @com.ptc.windchill.annotations.metadata.MyRole
    • foreignKeyRole

      ForeignKeyRole foreignKeyRole
      The properties of the "aggregated" (one/zero-to-one cardinality) role. This is the role that results in the generation of accessor methods for the stored reference as well as the persistable itself. This role is stored as a reference in the table represented by the object on the myRole() role and can be indicated to be autonavigated. For the master/iteration foreign key association, this role is the "master" side.

      Rose conversion note: Corresponds to Association Specification -> Role B General as well as Association Specification -> Windchill B.

      Supported API: true

    • myRoleIsRoleA

      boolean myRoleIsRoleA
      Specifies which role serves as the "A" role for the association. Leave blank to reuse the parent's designation for this property. Foreign key associations have two roles (as they are links), an "A" role (which usually represents the "strong" or "owning" side of the association) and a "B" role. The master/iteration association would specify "false" for this property because while the iteration aggregates the master, the master owns the association.

      Rose conversion note: Corresponds to Association Specification -> Role A/B General.

      Supported API: true

      Default:
      true