Annotation Interface OneToMany


@Target({FIELD,METHOD}) @Retention(RUNTIME) public @interface OneToMany
Specifies a one-to-many relationship between two entities.

This relationship maps a collection of child entities to a parent entity.

This annotation is applied to fields or properties within entity classes to configure the many-to-many mapping.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specifies the name of the field in the child entity that owns the relationship in a bidirectional association.
  • Element Details

    • mappedByField

      String mappedByField
      Specifies the name of the field in the child entity that owns the relationship in a bidirectional association. This attribute is typically used in the context of Object-Relational Mapping (ORM) to establish a one-to-many relationship.
      Returns:
      The name of the field in the child entity that represents the owning side of the relationship.